Subject 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 HR ly ing 80 71 74 68 76 72 72 60 78 86 86 74 60 60 68 54 68 64 64 60 70 80 60 60 82 64 84 95 78 56 72 68 76 76 68 56 HR sitting 66 73 80 76 84 80 88 64 72 88 88 74 62 76 69 58 72 88 90 66 80 84 84 68 75 68 88 92 80 65 80 72 100 84 81 80 HR standing 60 86 78 72 88 88 92 70 68 96 96 80 65 72 75 60 80 64 90 70 86 86 90 72 86 72 96 91 80 76 104 92 80 92 76 88 Effects of posture 84 80 HR 76 (bpm) 72 68 64 lying sitting standing Does posture affect HR? Analysis of variance (ANOVA): Based on the null hypothesis that all 3 samples are drawn from the same population, so that the variance of each sample will be an estimate of the same (population) variance (). Thus, according to the null hypothesis, the variance within samples or the variance between samples are both estimates of the population variance The “within samples” variance is determined by calculating, for each sample, the sum of squares (SS) of differences between each value and the sample mean, adding these up and dividing by the number of degrees of freedom. The “between samples” variance is determined by (1) calculating the mean of all values for all samples (the “grand mean”), (2) in each sample, replace each individual value by the mean of that sample; (3) then calculating the sum of squares (SS) of differences between each new replaced value and the grand mean, adding these up and dividing by the number of degrees of freedom. “within samples” variance Subj e c t 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 x (x1 x) 2 (SS) HR ly ing 80 71 74 68 76 72 72 60 78 86 86 74 60 60 68 54 68 64 64 60 70 80 60 60 82 64 84 95 78 56 72 68 76 76 68 56 HR sitting “between samples” variance HR sta nding 66 73 80 76 84 80 88 64 72 88 88 74 62 76 69 58 72 88 90 66 80 84 84 68 75 68 88 92 80 65 80 72 100 84 81 80 HR ly ing 60 86 78 72 88 88 92 70 68 96 96 80 65 72 75 60 80 64 90 70 86 86 90 72 86 72 96 91 80 76 104 92 80 92 76 88 70.56 77.64 81.03 3322.89 3252.31 4336.97 7 0 .5 6 7 0 .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1 .0 3 8 1 .0 3 8 1 .0 3 77.64 54.49 81.03 768.40 Total SS = 1233.01 + 54.49 + 768.40 = 2055.90 No. of degrees of freedom = (36 -1) + (36 -1) + (36 -1) = 105 2 HR sitting No. of degrees of freedom = (3-1) = 2 Variance estimate = 2055.87/2 = 1027.95 Thus, the estimate of the population variance based on the variations between sample means (1027.95) is much greater than the estimate based on variations of individual values about their own sample means (103.93). If the null hypothesis were correct, one would expect the two estimates to be similar. The degree of discrepancy is called F, and is calculated as the ratio: between sample variance estimate/ within sample variance estimate In this case, F = 1029.95/103.93 = 9.89 Assuming the null hypothesis is true, what is the probability of obtaining By chance a value of F ≥ 9.89 on (2,105) degrees of freedom? Answer: P = 0.00012 Therefore the null hypothesis is rejected ANOVA tests can be performed on Excel. The results will look like the following: A nova: Single F ac tor SU M M A RY Groups H R lying H R s itting H R s tanding Count 36 36 36 A NO V A Source of Variation Between G roups Within G roups SS 2 0 5 5 .9 1 0 9 1 2 .2 T otal 1 2 9 6 8 .1 Sum 2540 2795 2917 df 2 105 107 Average Variance 7 0 .6 9 4 .9 7 7 .6 9 2 .9 8 1 .0 1 2 3 .9 MS 1 0 2 7 .9 5 1 0 3 .9 3 F 9 .8 9 P-value 0 .0 0 0 1 2 F crit 3 .0 8 In the data set above, the gender of the subject was also recorded, as follows: HR ly ing 80 71 74 68 76 72 72 60 78 86 86 74 60 60 68 54 68 64 64 60 70 80 60 60 82 64 84 95 78 56 72 68 76 76 68 56 HR sitting 66 73 80 76 84 80 88 64 72 88 88 74 62 76 69 58 72 88 90 66 80 84 84 68 75 68 88 92 80 65 80 72 100 84 81 80 HR sta ndingGende r 6 0 fe male 8 6 fe male 7 8 fe male 7 2 fe male 8 8 fe male 8 8 fe male 9 2 fe male 7 0 fe male 6 8 fe male 9 6 fe male 9 6 fe male 8 0 fe male 6 5 fe male 7 2 fe male 7 5 fe male 6 0 fe male 8 0 fe male 6 4 fe male 9 0 male 7 0 male 8 6 male 8 6 male 9 0 male 7 2 male 8 6 male 7 2 male 9 6 male 9 1 male 8 0 male 7 6 male 1 0 4 male 9 2 male 8 0 male 9 2 male 7 6 male 8 8 male Effects of posture 92 88 84 girls boys 80 76 72 68 64 1) 2) 3) lying sitting standing Does posture affect HR? Is there a difference between males and females? Are the effects of posture and gender on HR additive or interactive? In this case, there are two factors that affect the variable (posture and gender). To answer the previous questions, an ANOVA (two factor with replication) is required. The results are as follows: A nov a: T wo-F ac tor With Replic ation S U M M A RY H R ly ing H R s itting H R s tanding T otal female C ount S um A verage V arianc e 18 1271 7 0 .6 1 7 9 .4 3 18 1358 7 5 .4 4 8 9 .6 7 18 1390 7 7 .2 2 1 3 9 .0 1 54 4019 7 4 .4 3 1 0 6 .7 8 18 1269 7 0 .5 0 1 1 6 .0 3 18 1437 7 9 .8 3 9 1 .4 4 18 1527 8 4 .8 3 8 5 .4 4 54 4233 7 8 .3 9 1 2 9 .9 0 36 2540 7 0 .5 6 9 4 .9 4 36 2795 7 7 .6 4 9 2 .9 2 36 2917 8 1 .0 3 1 2 3 .9 1 1 2 2 102 MS 4 2 4 .0 4 1 0 2 7 .9 5 1 3 5 .4 0 1 0 0 .1 7 male C ount S um A verage V arianc e Total C ount S um A verage V arianc e A NO V A Source of Variation S ample C olumns I nterac tion Within T otal SS 4 2 4 .0 4 2 0 5 5 .9 1 2 7 0 .8 0 1 0 2 1 7 .3 3 1 2 9 6 8 .0 7 df 107 F 4 .2 3 1 0 .2 6 1 .3 5 P-value 0 .0 4 2 1 9 0 .0 0 0 0 9 0 .2 6 3 4 0 F crit 3 .9 3 3 .0 9 3 .0 9 Imagine that we have a slightly different set of data, where the differences between the genders are more exaggerated, as follows: Ge nde r female female female female female female female female female female female female female female female female female female male male male male male male male male male male male male male male male male male male HR ly ing HR sitting HR standing 80 71 74 68 76 72 72 60 78 86 86 74 60 60 68 54 68 64 64 60 70 80 60 60 82 64 84 95 78 56 72 68 76 76 68 56 67 74 81 77 85 81 89 65 73 89 89 75 63 77 70 59 73 89 94 69 83 87 87 71 78 71 92 96 83 68 83 75 104 87 84 83 62 89 80 74 91 91 95 72 70 99 99 82 67 74 77 62 82 66 97 76 93 93 97 78 93 78 104 98 86 82 112 99 86 99 82 95 Effects of posture 92 88 84 girls boys 80 76 72 68 64 1) 2) 3) lying sitting standing Does posture affect HR? Is there a difference between males and females? Are the effects of posture and gender on HR additive or interactive? The results are as follows. Note that the P-values are less A nova: T wo-F ac tor With Replic ation SU M M A RY H R lying H R s itting H R s tanding T otal female C ount Sum A verage V arianc e 18 1 2 7 1 .0 0 7 0 .6 1 7 9 .4 3 18 18 1 3 7 8 .3 7 1 4 3 1 .7 0 7 6 .5 8 7 9 .5 4 9 2 .3 8 1 4 7 .4 7 54 4 0 8 1 .0 7 7 5 .5 8 1 1 6 .4 6 18 1 2 6 9 .0 0 7 0 .5 0 1 1 6 .0 3 18 18 1 4 9 4 .4 8 1 6 4 9 .1 6 8 3 .0 3 9 1 .6 2 9 8 .9 0 9 9 .6 6 54 4 4 1 2 .6 4 8 1 .7 2 1 7 7 .5 3 36 2 5 4 0 .0 0 7 0 .5 6 9 4 .9 4 36 36 2 8 7 2 .8 5 3 0 8 0 .8 6 7 9 .8 0 8 5 .5 8 1 0 3 .6 1 1 5 7 .5 7 male C ount Sum A verage V arianc e Total C ount Sum A verage V arianc e A NO V A Source of Variation Sample C olumns I nterac tion Within T otal SS df 1 0 1 7 .9 5 4 1 3 5 .0 6 6 7 0 .2 3 1 0 7 7 5 .8 7 1 2 2 102 1 6 5 9 9 .1 1 107 MS 1 0 1 7 .9 5 2 0 6 7 .5 3 3 3 5 .1 1 1 0 5 .6 5 F 9 .6 4 1 9 .5 7 3 .1 7 P-value 0 .0 0 2 5 0 .0 0 0 0 0 0 0 6 0 .0 4 6 1 F crit 3 .9 3 3 .0 9 3 .0 9 Imagine a quite different data set, as follows: Gender female female female female female female female female female female female female female female female female female female male male male male male male male male male male male male male male male male male male HR ly ing HR sitting HR standing 80 71 74 68 76 72 72 60 78 86 86 74 60 60 68 54 68 64 90 70 86 86 90 72 86 72 96 91 80 76 104 92 80 92 76 88 66 73 80 76 84 80 88 64 72 88 88 74 62 76 69 58 72 88 94 69 83 87 87 71 78 71 92 96 83 68 83 75 104 87 84 83 60 86 78 72 88 88 92 70 68 96 96 80 65 72 75 60 80 64 64 60 70 80 60 60 82 64 84 95 78 56 72 68 76 76 68 56 Effects of posture 92 girls 88 boys 84 80 76 72 68 64 1) 2) 3) lying sitting standing Does posture affect HR? Is there a difference between males and females? Are the effects of posture and gender on HR additive or interactive? The results are as follows: A nova: T wo-F ac tor With Replic ation S U M M A RY H R lying H R s itting H R s tanding T otal female C ount S um A verage V arianc e 18 1271 7 0 .6 1 7 9 .4 3 18 1358 7 5 .4 4 8 9 .6 7 18 1390 7 7 .2 2 1 3 9 .0 1 54 4019 7 4 .4 3 1 0 6 .7 8 18 1527 8 4 .8 3 8 5 .4 4 18 1 4 9 4 .4 8 8 3 .0 3 9 8 .9 0 18 54 1 2 6 9 4 2 9 0 .4 8 7 0 .5 0 7 9 .4 5 3 3 3 1 1 6 .0 3 1 3 7 .7 3 7 8 36 2798 7 7 .7 2 1 3 2 .0 9 36 2 8 5 2 .4 8 7 9 .2 4 1 0 6 .3 8 36 2659 7 3 .8 6 1 3 5 .4 9 male C ount S um A verage V arianc e Total C ount S um A verage V arianc e A NO V A Source of Variation SS S ample 6 8 2 .4 2 C olumns 5 5 3 .0 0 I nterac tion 2 0 6 2 .1 3 Within 1 0 3 4 4 .1 8 T otal 1 3 6 4 1 .7 2 6 df MS 1 2 2 102 107 6 8 2 .4 2 2 7 6 .5 0 1 0 3 1 .0 6 1 0 1 .4 1 F 6 .7 3 2 .7 3 1 0 .1 7 P-value 0 .0 1 0 8 8 0 .0 7 0 2 2 0 .0 0 0 0 9 F crit 3 .9 3 3 .0 9 3 .0 9