No solution required.
No solution required.
No solution required.
No solution required.
No solution required.
We can use the following code:
## Warning: package 'datarium' was built under R version 4.1.2
## Warning: package 'tidyr' was built under R version 4.1.2
boxplot(selfesteem.long$score ~ selfesteem.long$time,
col = c("cornflowerblue", "brown2", "darkgoldenrod1"),
ylab = "Self-esteem score", xlab = "Time-point")
scoretimeWe can use the following code:
anova.selfesteem <- aov(score ~ time + Error(id), data = selfesteem.long)
summary(anova.selfesteem)
##
## Error: id
## Df Sum Sq Mean Sq F value Pr(>F)
## Residuals 9 4.57 0.5078
##
## Error: Within
## Df Sum Sq Mean Sq F value Pr(>F)
## time 2 102.46 51.23 55.47 2.01e-08 ***
## Residuals 18 16.62 0.92
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Df column, time row.Df column, Residuals row.pairwise.t.test(selfesteem.long$score, selfesteem.long$time, paired = TRUE,
p.adjust.method = "bonferroni")
##
## Pairwise comparisons using paired t tests
##
## data: selfesteem.long$score and selfesteem.long$time
##
## t1 t2
## t2 0.0023 -
## t3 1e-06 0.0027
##
## P value adjustment method: bonferroni
Based on the output, there was a statistically significant difference in mean self-esteem scores between all pairs of time-points. In particular:
No solution required.
No solution required.
The code and required output is:
lme.selfesteem <- lme(score ~ time, random = ~1|id, data = selfesteem.long)
summary(lme.selfesteem)
## Value Std.Error DF t-value p-value
## (Intercept) 3.140122 0.2801731 18 11.207793 1.502987e-09
## timet2 1.793820 0.3962246 18 4.527281 2.608300e-04
## timet3 4.496220 0.3962246 18 11.347655 1.234335e-09
These notes have been prepared by Amanda Shaker. The copyright for the material in these notes resides with the authors named above, with the Department of Mathematics and Statistics and with La Trobe University. Copyright in this work is vested in La Trobe University including all La Trobe University branding and naming. Unless otherwise stated, material within this work is licensed under a Creative Commons Attribution-Non Commercial-Non Derivatives License BY-NC-ND.