IntroductionANOVA is an abbreviation for ANalysis Of VAriance. It is a statistical technique for comparing the means of several sets of data to decide whether the differences between the means are significant or whether they are just random sampling variations. The basic idea is that you have several sets or groups of measurements and compare the variation within individual measurements within groups to the variation between the means of the groups. If the ratio of between groups variation divided by within groups variation is greater than a critical 'F' value then the conclusion, at a given confidence level, is that at least one of the means is genuinely different from the rest. The arithmetic involved in ANOVA testing is quite simple but there is a lot of it and it is easy to make mistakes when doing the calculations manually, hence the utility of an automated program. | |||
A Worked Example of One-Way Anova(See a statistical textbook for a full explanation of the principles of ANOVA.) Three different analytical laboratories determine the fat content of 'Turkey Twirls', each performing four replicate determinations. Their results are:
Our 'null hypothesis', H0, for this investigation is that there is no bias in any of the laboratories' results and that the true mean results from each, if they were to carry out a large number of replicates, would be the same. There are three groups, each containing four values, making 12 values in all. First we calculate the 'Total Sum of Squares' as Next calculate the 'Between Groups Sum of Squares' as Calculate the 'Within Groups Sum of Squares' by subtracting the Between Sum of Squares from the Total Sum of Squares The 'Between Groups Degrees of Freedom' is one less than the number of groups, or 2 in this example. The 'Mean Square Between Groups' is the Between Sum of Squares divided by the Between Degrees of Freedom, or 4.372/2 = 2.186. The 'F-value' for the data is the Mean Square Between divided by the Mean Square Within, or 2.186/0.0817 = 26.8. If this probability is greater than 95% we can be reasonably confident that there is some genuine bias in one or more of the laboratories' results, and so we reject the null hypothesis. Since it is actually greater than 99.9% we can be virtually certain that the three laboratories are not all producing the same results.
| |||
ANOVA on the hp 39g+ Graphing CalculatorThis program does all the calculations for you, given a list of the data values, and presents the results in a reasonably understandable format. | |||
Loading ANOVACopy the files ANOVA000.000, HP39DIR.000 and HP39DIR.CUR to an empty directory on a PC, start the HP39G Connectivity program and point it to the directory holding the three files. | |||
Entering DataData needs to be entered before running the program.
This method though is a bit cumbersome when there are several groups and many values per group. In this case it is better to use the List Editor.
| |||
Running ANOVAOnce all the data has been entered into L1, run ANOVA from the PROGRAM catalogue or the HOME screen.
(The display will be 'frozen' at this point; press any key to remove the results and return to the previous display.)
If the calculated F-value is less than the critical F-value at the 95% confidence level then it is not proven that the means are different and so they are assumed to be the same. A slightly different results display is shown:
On returning to the HOME screen the following variables contain possibly useful values:
| |||
Error MessagesIf any of the elements of L1 are single values rather than lists, such as {{1,2,3},4,{5,6,7}}, then the message L1 must be a list of lists is shown, since each element must be a list of values. If L1 contains only a single group of data, such as {{10,11,12,13}}, or is empty, then the message Minimum 2 data sets in L1 is given, since ANOVA requires at least two sets (groups) of values. (In practice if you have only two groups you are better off doing a Student's t-test to compare their means, though ANOVA is possible.) | |||
Hardware RequirementsANOVA runs on a Hewlett-Packard 39g+ calculator. It should also work on the 39g and 40g, and possibly the 38g, but has not been tested. The program takes up 0.56 kilobytes of RAM when first loaded, which expands to 1.8 kilobytes when run. There needs to be enough free memory to store the data in L1 of course. | |||
Variables UsedANOVA uses the following HOME variables, and will therefore overwrite any existing information stored in them:
| |||
Possible ImprovementsWhen a genuine difference between the means has been found, include a test to determine which one(s) is/are different. |
Program ListingSIZE(L1)®C: IF C<2 THEN MSGBOX "Minimum 2 data sets in L1":STOP:END: å(I=1,C,SIZE(L1(I)))®N: IFERR å(I=1,C,åLIST(L1(I)))²/N®F THEN MSGBOX "L1 must be a list of lists": STOP:END: å(I=1,C,åLIST(L1(I))²/SIZE(L1(I)))-F®B: å(I=1,C,åLIST(L1(I)²))-F-B®W: (B/(C-1))/(W/(N-C)®F: UTPF(C-1,N-C,F)®P: 100-100*P®C: ERASE: DISP 1;">>>>ANOVA Results<<<<": IF C>95 THEN DISP 3;"Means differ at 95%": ELSE DISP 3;"Means same at 95%":END: DISP 4;"F = "ROUND(F,-5): DISP 5;"Prob= "ROUND(P,-5): DISP 6;"(Chance H0 is false": DISP 7;"= "ROUND(C,3)"%)": FREEZE: (Note: ® means 'STO') |
CommentsStore number of groups. If there are fewer then 2 groups then print error message and stop. Count total number of values. Calculate Total Sum of Squares. If any groups are not a list this causes an error so trap it and show error message. Calculate Between Groups Sum of Squares. Calculate Within Groups Sum of Squares. Calculate F-value for data. Find probability of this being due to chance. Convert to percentage confidence. Clear display. Show title. If confidence of real difference is >95% report that means are different, otherwise report they are the same. Display rounded F-value. Display rounded probability. Report confidence level that all the means are not the same. Pause until a key is pressed. |
Program written by Peter Ochocki, December 2005.