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 Heght 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 |
Here is a complete list of the operators available in OxonStat:
| Symbol | Action | Example | Result | Precedence |
|---|---|---|---|---|
| ^ | Raise to the power of | 10^2 | 100 | 5 |
| * | Multiply | 3*4 | 12 | 4 |
| / | Divide | 20/5 | 4 | 3 |
| + | Add | 1+2 | 3 | 2 |
| - | Subtract | 21-1 | 20 | 1 |
When a formula contains more than one operator, those with a higher precedence, as shown in the table above, are calculated first. For example "1+7*10" would produce an answer of 71, rather than 80. Since * has a higher precedence than the +, OxonStat calculates 7*10 and then 70+1.
You can use parentheses ( ) to alter the order of calculation. The contents of parentheses are calculated before operators outside of them are considered. So "(1+7)*10" forces the 1+7 to calculate before multiplying by 10 to produce 80.
The available functions are documented in the Function reference