OxonStat formulae allow new Variables to be created using any combination of constants, variables, operators and functions. Operators allow things such as addition and subtraction. Functions provide common mathematical transformations such as logs and trigonometry, but also provide more advanced things like normally distributed random number sequences.
If you are familiar with formulae in Microsoft Excel or other spreadsheets you will find that formulae in OxonStat are slightly different, in a useful way. In a spreadsheet if you wanted to calculate the BMI for a series of people you would typically have to create a formula for the first row and then copy and paste it for all other rows. If you later added more rows to the spreadsheet you would have to copy the formula to those new rows in order for it to work.
Assuming your data for Weight are in column A and Heights in column B, you would have formulae such as "=A1/B1^2", "=A2/B2^2" etc, which makes it more difficult to find out what is happening when you revisit the spreadsheet some time later.
In OxonStat life is simpler. You create a Column named Weight and another named Height and enter some data.
You can then create a new column called BMI, and assign it a formula of "Weight / Height^2" and press OK.
The results are as follows:
Entering new values for Weight and Height automatically calculates the results for BMI, even if you add rows to the Dataset. Obviously, altering a Height or Weight causes the BMI to be recalculated accordingly.
There is also a dialog box where you can view all the formulae within a given Dataset.
| Assuming you have | Forumula | Results in |
|---|---|---|
| A Variable called Height recorded in metres. A Variable called Weight recorded in kg. | Weight / Height ^ 2 | The Body Mass Index (BMI) |
| A Variable called Height recorded in centimetres. A Variable called Weight recorded in kg. | Weight / ( Height / 100 ) ^ 2 | The Body Mass Index (BMI) |
| A Variable called Angle recorded in degrees. | sin( radians( Angle ) ) | The sine of the angle |
When typing elements into an OxonStat formula, use these simple formatting rules. Please note that case is not important for matches or variable tracking; the software treats uppercase and lowercase letters identically for your column names and logical comparisons (e.g., Age, age, and AGE are handled as the exact same variable).
However, OxonStat completely honours the exact case of any textual values you physically enter or save in your Datasets.
When you combine your variables with fixed values, OxonStat processes the calculations from left to right using a strict mathematical hierarchy.
Because and and or are treated equally and processed straight from left to right, changing the order of your words changes who gets included in your cohort. If you mix and and or in the same line, always use brackets to make your clinical intent explicit.
The available functions are documented in the Function reference