r:repeated_measure_anova
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
r:repeated_measure_anova [2024/05/08 08:20] – hkimscil | r:repeated_measure_anova [2024/05/08 08:23] (current) – [E.g. 2] hkimscil | ||
---|---|---|---|
Line 120: | Line 120: | ||
</ | </ | ||
====== E.g. 2 ====== | ====== E.g. 2 ====== | ||
+ | {{: | ||
< | < | ||
# the second | # the second | ||
Line 132: | Line 133: | ||
#view data | #view data | ||
movrev | movrev | ||
- | write.csv(movrev, | + | write.csv(movrev, |
movrev$movie <- factor(movrev$movie) | movrev$movie <- factor(movrev$movie) | ||
Line 156: | Line 157: | ||
</ | </ | ||
+ | |||
+ | < | ||
+ | > # the second | ||
+ | > movrev <- data.frame(reviewer=rep(1: | ||
+ | + movie=rep(1: | ||
+ | + score=c(88, 84, 92, | ||
+ | + 76, 78, 90, | ||
+ | + 78, 94, 95, | ||
+ | + 80, 83, 88, | ||
+ | + 82, 90, 99)) | ||
+ | > | ||
+ | > #view data | ||
+ | > movrev | ||
+ | | ||
+ | 1 | ||
+ | 2 | ||
+ | 3 | ||
+ | 4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 4 | ||
+ | 11 4 | ||
+ | 12 4 | ||
+ | 13 5 | ||
+ | 14 5 | ||
+ | 15 5 | ||
+ | > write.csv(movrev, | ||
+ | > | ||
+ | > movrev$movie <- factor(movrev$movie) | ||
+ | > movrev$reviewer <- factor(movrev$reviewer) | ||
+ | > | ||
+ | > # Error(reviewer) = reviewer error should be isolated | ||
+ | > # The above is the same as Error(reviewer/ | ||
+ | > m.aov <- aov(score ~ movie | ||
+ | + + Error(reviewer), | ||
+ | + data = movrev) | ||
+ | > #view model summary | ||
+ | > summary(m.aov) | ||
+ | |||
+ | Error: reviewer | ||
+ | Df Sum Sq Mean Sq F value Pr(>F) | ||
+ | Residuals | ||
+ | |||
+ | Error: Within | ||
+ | Df Sum Sq Mean Sq F value Pr(> | ||
+ | movie 2 363.3 181.67 | ||
+ | Residuals | ||
+ | --- | ||
+ | Signif. codes: | ||
+ | > | ||
+ | > # pairwise.t.test(movrev$score, | ||
+ | > attach(movrev) | ||
+ | The following objects are masked from movrev (pos = 5): | ||
+ | |||
+ | movie, reviewer, score | ||
+ | |||
+ | > pairwise.t.test(score, | ||
+ | |||
+ | Pairwise comparisons using paired t tests | ||
+ | |||
+ | data: score and movie | ||
+ | |||
+ | 1 | ||
+ | 2 0.628 - | ||
+ | 3 0.029 0.060 | ||
+ | |||
+ | P value adjustment method: bonferroni | ||
+ | > # or | ||
+ | > with(movrev, | ||
+ | + pairwise.t.test(score, | ||
+ | + paired = T, | ||
+ | + p.adjust.method = " | ||
+ | |||
+ | Pairwise comparisons using paired t tests | ||
+ | |||
+ | data: score and movie | ||
+ | |||
+ | 1 | ||
+ | 2 0.628 - | ||
+ | 3 0.029 0.060 | ||
+ | |||
+ | P value adjustment method: bonferroni | ||
+ | > | ||
+ | </ |
r/repeated_measure_anova.1715124012.txt.gz · Last modified: 2024/05/08 08:20 by hkimscil