In: Statistics and Probability
The dataset ’anorexia’ in the MASS package in R-Studio contains data for an anorexia study. In the study, three treatments (Treat) were applied to groups of young female anorexia patients, and their weights before (Prewt) and after (Postwt) treatment were recorded. The three treatments adminstered were no treatment (Cont), Cognitive Behavioural treatment (CBT), and family treatment (FT).
Determine at the 5% significance level if there is a difference in mean weight gain between those receiving no treatment and those receiving Cognitive behavioral treatment. Perform all necessary steps for the hypothesis test and interpret your results in the context of the study. Assume random selection and normal population distribution for all samples and populations.
Treat Prewt Postwt
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
7 Cont 87.3 75.1
8 Cont 75.1 86.7
9 Cont 80.6 73.5
10 Cont 78.4 84.6
11 Cont 77.6 77.4
12 Cont 88.7 79.5
13 Cont 81.3 89.6
14 Cont 78.1 81.4
15 Cont 70.5 81.8
16 Cont 77.3 77.3
17 Cont 85.2 84.2
18 Cont 86.0 75.4
19 Cont 84.1 79.5
20 Cont 79.7 73.0
21 Cont 85.5 88.3
22 Cont 84.4 84.7
23 Cont 79.6 81.4
24 Cont 77.5 81.2
25 Cont 72.3 88.2
26 Cont 89.0 78.8
27 CBT 80.5 82.2
28 CBT 84.9 85.6
29 CBT 81.5 81.4
30 CBT 82.6 81.9
31 CBT 79.9 76.4
32 CBT 88.7 103.6
33 CBT 94.9 98.4
34 CBT 76.3 93.4
35 CBT 81.0 73.4
36 CBT 80.5 82.1
37 CBT 85.0 96.7
38 CBT 89.2 95.3
39 CBT 81.3 82.4
40 CBT 76.5 72.5
41 CBT 70.0 90.9
42 CBT 80.4 71.3
43 CBT 83.3 85.4
44 CBT 83.0 81.6
45 CBT 87.7 89.1
46 CBT 84.2 83.9
47 CBT 86.4 82.7
48 CBT 76.5 75.7
49 CBT 80.2 82.6
50 CBT 87.8 100.4
51 CBT 83.3 85.2
52 CBT 79.7 83.6
53 CBT 84.5 84.6
54 CBT 80.8 96.2
55 CBT 87.4 86.7
#### R Statistical
Software ####
library(MASS)
data(anorexia)
library(tidyr)
df <-
gather(anorexia,
key
= "pre_post",
value
= "weight",
2:3)
model
= aov(weight~.,
data
= df)
summary(model)
##
Df Sum Sq Mean Sq F value
Pr(>F)
##
Treat
2 644 322.1 7.713 0.000664
***
##
pre_post 1
275 275.0 6.585 0.011335 *
## Residuals
140 5847
41.8
## ---
## Signif. codes: 0 '***'
0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## you can see that
the p-value between pre_post isd 0.011335 < 0.05. Implies there
is a
##
significant difference in mean weight gain.