680 likes | 784 Views
BS704 Class 8 Analysis of Variance. HW Set #7. Chapter 7 Problems 5, 14, 19 and 28 R Problem Set 7 (on Blackboard) Due November 2 Please complete Quiz 9 Before Nov 2. An RCT to Assess the Efficacy of a New Drug for Asthma in Children. Background characteristics Age Sex
E N D
HW Set #7 Chapter 7 Problems 5, 14, 19 and 28 R Problem Set 7 (on Blackboard) Due November 2 Please complete Quiz 9Before Nov 2
An RCT to Assess the Efficacy of a New Drug for Asthma in Children • Background characteristics • Age • Sex • Years since diagnosis of asthma • Outcomes • Self-reported improvement in symptoms • FEV1
Did the randomization work? • Yes • No Characteristic Placebo New Drug p Age, years 10 (2.4) 9.9 (2.1) .76 % Male 54% 43% .04 Yrs since Dx 3.4 (1.9) 3.1 (2.1) .34
What are hypotheses to compare ages? • H0:m1=m2 vs H1:m1≠m2 • H0:p1=p2 vs H1:p1≠p2 • H0:m=10 vs H1:m≠10 • H0:md=0 vs H1:md≠0 Characteristic Placebo New Drug p Age, years 10 (2.4) 9.9 (2.1) .76 % Male 54% 43% .04 Yrs since Dx 3.4 (1.9) 3.1 (2.1) .34
What test would be used to compare % improvement between groups? • Test for equality of means • Test for equality of proportions • Test for mean difference • No clue
What test would be used to compare FEV1 between groups? • Test for equality of means • Test for equality of proportions • Test for mean difference • No clue
Objectives • Understand the procedure for testing the equality of k > 2 means • Perform the test by hand and using R • Appropriately interpret results
Hypothesis Testing Procedures 1. Set up null and research hypotheses, select a 2. Select test statistic 3. Set up decision rule 4. Compute test statistic 5. Draw conclusion & summarize significance (p-value)
Hypothesis Testing for More than 2 Means - Analysis of Variance • Continuous outcome • k Independent Samples, k > 2 H0: m1=m2=m3 … =mk H1: Means are not all equal Test Statistic (Find critical value in Table 4)
Test Statistic - F Statistic • Comparison of two estimates of variability in data • Between treatment variation, is based on the assumption that H0 is true (i.e., population means are equal) • Within treatment, Residual or Error variation, is independent of H0 (i.e., we do not assume that the population means are equal and we treat each sample separately)
F Statistic Difference BETWEEN each group mean and overall mean Difference between each observation and its group mean (WITHIN group variation - ERROR)
F Statistic F = MSB/MSE MS = Mean Square What values of F that indicate H0 is likely true?
Decision Rule Reject H0 if F > Critical Value of F with df1=k-1 and df2=N-k from Table 4 k= # comparison groups N=Total sample size
ANOVA Table Source of Sums of Mean Variation Squares df Squares F Between Treatments k-1 SSB/k-1 MSB/MSE Error N-k SSE/N-k Total N-1
Example Is there a significant difference in mean weight loss among 4 different diet programs? (Data are pounds lost over 8 weeks)
Example Summary Statistics on Weight Loss by Treatment Low-Cal Low-Fat Low-Carb Control n 5 5 5 5 Mean 6.6 3.0 3.4 1.2 Overall Mean = 3.6
Is there a statistically significant difference in weight loss programs? • Yes • No • ??
Example 1. H0: m1=m2=m3=m4 H1: Means are not all equal a=0.05 2. Test statistic
Example 3. Decision rule df1=k-1=4-1=3 df2=N-k=20-4=16 Reject H0 if F > 3.24
Example =5(6.6-3.6)2+5(3.0-3.6)2+5(3.4-3.6)2+5(1.2-3.6)2 = 75.8
Example =21.4 + 10.0 + 5.4 + 10.6 = 47.4
Example Source of Sums of Mean Variation Squares df Squares F Between 75.8 3 25.3 8.43 Treatments Error 47.4 16 3.0 Total 123.2 19
Example 4. Compute test statistic F=8.43 5. Conclusion. Reject H0 because 8.43 > 3.24. We have statistically significant evidence at a=0.05 to show that there is a difference in mean weight loss among 4 different diet programs.
ANOVA Using R .csv data file
Example An investigator wishes to compare the average time to relief of headache pain under three distinct medications, A, B and C. Fifteen patients who suffer from chronic headaches are randomly selected for the investigation. The outcome is time to pain relief, in minutes.
One Way ANOVA RCT to Compare 3 Medications for Chronic Pain N=15 Randomize A B C Outcome: Time to Pain Relief, minutes
One Way ANOVA (cont’d) Data Drug A Drug B Drug C 30 25 15 35 20 20 40 30 25 25 20 20 35 30 20 Mean 33.0 25.0 20.0
One Way ANOVA (cont’d) • Hypotheses H0: m1 = m2 = m3 H1: means not all equal a=0.05 2. Test Statistic F
One Way ANOVA (cont’d) 3. Decision Rule K-1=3-1=2, N-k=15-3=12 Reject H0 if F > 3.89 4. Compute Sums of Squares
One Way ANOVA (cont’d) = 5((33-26.0)2 + (25-26.0)2 + (20-26.0)2) = 430
One Way ANOVA (cont’d) Drug A X (X-33) (X-33)2 30 -3 9 35 -2 4 40 7 49 25 -8 64 35 -2 4 0 130
One Way ANOVA (cont’d) Drug B X (X-25) (X-25)2 25 0 1 20 -5 25 30 5 25 20 -5 25 30 5 25 0 100
One Way ANOVA (cont’d) Drug C X (X-20) (X-20)2 15 -5 25 20 0 0 25 5 25 20 0 0 20 0 0 0 50
One Way ANOVA (cont’d) = 130+100+50 = 280 Source SS df MS F Between 430.0 2 215 9.21 Error 280.0 12 23.3 Total 710.0 14
One Way ANOVA (cont’d) Reject H0 since 9.21 > 3.89 – Means are not all equal.
Paper – Testosterone Replacement • Study design? • RCT • Number of comparison groups? -placebo, no exercise -testosterone, no exercise -placebo and exercise -testosterone and exercise • Primary outcomes? • Change in muscle strength, body weight, muscle volume, lean body mass (continuous)
Paper – Testosterone Replacement • Objective is to compare mean change in muscle strength, body weight, muscle volume, lean body mass (One at a time) across four treatment groups • Figure 1 – generalizability?
Paper – Testosterone Replacement • Table 1 – what tests were used? • Table 2 – what tests were used?
Practice Problem – Complete the ANOVA Table H0: m1=m2=m3=m4=m5 H1: means not all equal a=0.05 Source SS df MS F Between Within 50 2.5 Total 225
Practice Problem – Complete the ANOVA Table H0: m1=m2=m3=m4=m5 H1: means not all equal a=0.05 Source SS df MS F Between 100 4 25 10 Within 125 50 2.5 Total 225 Reject H0 if F > F0.05(4,50)=2.56
ANOVA • When the sample sizes are equal, the design is said to be balanced • Balanced designs give greatest power and are more robust to violations of the normality assumption