In: Statistics and Probability
In R, Use the anorexia data set for questions 8-15
Recall there are three distinct treatments. You may be suspicious that there is a significant difference in the mean weights assigned to the different treatments. It is not a good experimental design if one of the treatments has subjects who are starting in a better position than the subjects of other treatments. To test if this is a well-designed experiment we perform an ANOVA analysis .The null hypothesis is the mean weight of the subjects assigned to each treatment group is the same.
Data set:
Treat <fctr> |
Prewt <dbl> |
Postwt <dbl> |
||
---|---|---|---|---|
1 | Cont | 80.7 | 80.2 | |
2 | Cont | 89.4 | 80.1 | |
3 | Cont | 91.8 | 86.4 | |
4 | Cont | 74.0 | 86.3 | |
5 | Cont | 78.1 | 76.1 | |
6 | Cont | 88.3 | 78.1 |
What is the value of the test statistic for the ANOVA test?
What is the p-value for the ANOVA test?
Using a significance level 0f 0.05, do you reject the null hypothesis?
What is the median weight gain of subjects assigned to the control treatment?
What is the median weight gain of subjects assigned to the CBT treatment?
What is the median weight gain of subjects assigned to the FT treatment?
What is the value of the maximum weight gain?
How many subjects lost weight during the course of the experiment?
In R, the comparison for PreWt and PostWt gives the following table:
> data =
read.csv("C:\\Users\\Temp\\Desktop\\anova.csv")
> model = lm(PostWt~PreWt, data = data)
> anova(model)
Analysis of Variance Table
Response: PostWt
Df Sum Sq Mean Sq F value Pr(>F)
PreWt 1 0.053 0.0534 0.0024 0.9637
Residuals 4 90.827 22.7067
1. Test statistic : 0.0024
2. P-value: 0.9637
3. since p-value > 0.05. We fail to reject Ho or can say that mean weight of the subjects assigned to each treatment group is not the same.
And summary for model is:
> summary(model)
Call:
lm(formula = PostWt ~ PreWt, data = data)
Residuals:
1 2 3 4 5 6
-0.9562 -1.1824 5.0828 5.2409 -5.0185 -3.1665
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 79.9857 25.1205 3.184 0.0334 *
PreWt 0.0145 0.2992 0.048 0.9637
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 4.765 on 4 degrees of freedom
Multiple R-squared: 0.0005873, Adjusted R-squared:
-0.2493
F-statistic: 0.002351 on 1 and 4 DF, p-value: 0.9637.
4. Median for PreWt = (80.7+89.4)/2 = 85.05
5. Median for PostWt = (80.1+80.2)/2 = 80.15
6. For observation 4, gain was maximum as PreWt =
74.0 |
and PostWt =
86.3 |
and gain = 86.3-74 = 12.3
7. All those subjects for which PostWt < PreWt lost their weight. So, For 1,2,3,5 and 6 weight loss was observed. Hence, 5 subjects lost their weight.
Please rate my answer and comment for doubt.