> stress_reaction <-c(10, 9, 8, 9, 10, 8, 8, 10, 6, 7, 8, 8, 4, 6, 6, 4, 2, 2)
> stress_level <- factor(rep(c("High", "Moderate", "Low"), each = 6))
> data <- data.frame(StressReaction = stress_reaction, StressLevel = stress_level)
> anova_result <-aov(StressReaction ~ StressLevel, data = data)
> summary(anova_result)
Df Sum Sq Mean Sq F value Pr(>F)
StressLevel 2 82.11 41.06 21.36 4.08e-05 ***
Residuals 15 28.83 1.92
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Question 1:
The degree of freedom for the StressLevel are 2, and the Residuals are 15. The sum of
squares for StressLevel are 82.11, and for the residuals, it is 28.83. The mean
square for StressLevel is 41.06, and for Residuals it is 1.92. The F value is 21.36,
and the p-value is 4.08e-05 (0.0000408).
Since the p-value (0.0000408) is less than 0.05 we cannot conclude that stress
levels affect the reactions.
Question 2:
> data("zelazo")
> zelazo
$active
[1] 9.00 9.50 9.75 10.00 13.00
[6] 9.50
$passive
[1] 11.00 10.00 10.00 11.75 10.50
[6] 15.00
$none
[1] 11.50 12.00 9.00 11.50 13.25
[6] 13.00
$ctr.8w
[1] 13.25 11.50 12.00 13.50 11.50
2.1 :
> Score <- c(zelazo$active, zelazo$passive, zelazo$none, zelazo$ctr.8w)
> Group <- c(rep("active", length(zelazo$active)), rep("passive", length(zelazo$passive)), rep("none", length(zelazo$none)), rep("ctr.8w", length(zelazo$ctr.8w)))
> zelazo_df <- data.frame(Score, Group)
> zelazo_df
Score Group
1 9.00 active
2 9.50 active
3 9.75 active
4 10.00 active
5 13.00 active
6 9.50 active
7 11.00 passive
8 10.00 passive
9 10.00 passive
10 11.75 passive
11 10.50 passive
12 15.00 passive
13 11.50 none
14 12.00 none
15 9.00 none
16 11.50 none
17 13.25 none
18 13.00 none
19 13.25 ctr.8w
20 11.50 ctr.8w
21 12.00 ctr.8w
22 13.50 ctr.8w
23 11.50 ctr.8w
> t_test_result <- t.test(Score[Group == "active"], Score[Group == "passive"])
> t_test_result
Welch Two Sample t-test
data: Score[Group == "active"] and Score[Group == "passive"]
t = -1.2839, df = 9.3497, p-value = 0.2301
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-3.4399668 0.9399668
sample estimates:
mean of x mean of y
10.125 11.375
The p-value is 0.2301, there is a no difference between active and passive. The
average score for active and passive are similar.
2.2 :
> aov.out = aov(Score ~ Group, data = zelazo_df)
> summary(aov.out)
Df Sum Sq Mean Sq F value Pr(>F)
Group 3 14.78 4.926 2.142 0.129
Residuals 19 43.69 2.299
The p-value on this ANOVA test is 0.129, meaning there is also no difference
between the groups.
Comments
Post a Comment