repeated_measure_anova
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
repeated_measure_anova [2023/05/01 00:15] – hkimscil | repeated_measure_anova [2023/05/03 08:04] – [demo 2] hkimscil | ||
---|---|---|---|
Line 257: | Line 257: | ||
see {{: | see {{: | ||
+ | ===== demo 2 ===== | ||
+ | < | ||
+ | # create data | ||
+ | df <- data.frame(patient=rep(1: | ||
+ | | ||
+ | | ||
+ | 14, 18, 10, 22, | ||
+ | 24, 20, 18, 30, | ||
+ | 38, 34, 20, 44, | ||
+ | 26, 28, 14, 30)) | ||
+ | # view data | ||
+ | df | ||
+ | |||
+ | # within sujbect anova | ||
+ | within.aov.mod <- aov(response~drug+Error(patient), | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | > #create data | ||
+ | > df <- data.frame(patient=rep(1: | ||
+ | + drug=rep(1: | ||
+ | + response=c(30, | ||
+ | + 14, 18, 10, 22, | ||
+ | + 24, 20, 18, 30, | ||
+ | + 38, 34, 20, 44, | ||
+ | + 26, 28, 14, 30)) | ||
+ | > | ||
+ | > #view data | ||
+ | > df | ||
+ | | ||
+ | 1 1 1 30 | ||
+ | 2 1 2 28 | ||
+ | 3 1 3 16 | ||
+ | 4 1 4 34 | ||
+ | 5 2 1 14 | ||
+ | 6 2 2 18 | ||
+ | 7 2 3 10 | ||
+ | 8 2 4 22 | ||
+ | 9 3 1 24 | ||
+ | 10 | ||
+ | 11 | ||
+ | 12 | ||
+ | 13 | ||
+ | 14 | ||
+ | 15 | ||
+ | 16 | ||
+ | 17 | ||
+ | 18 | ||
+ | 19 | ||
+ | 20 | ||
+ | > | ||
+ | > #within sujbect anova | ||
+ | > within.aov.mod <- aov(response~drug+Error(patient), | ||
+ | > | ||
+ | > | ||
+ | > summary(within.aov.mod) | ||
+ | |||
+ | Error: patient | ||
+ | Df Sum Sq Mean Sq F value Pr(>F) | ||
+ | Residuals | ||
+ | |||
+ | Error: Within | ||
+ | Df Sum Sq Mean Sq F value Pr(>F) | ||
+ | drug | ||
+ | Residuals 17 1412.6 | ||
+ | </ | ||
+ | The above is <fc # | ||
+ | < | ||
+ | within.aov.mod <- aov(response~factor(drug)+Error(factor(patient)), | ||
+ | |||
+ | summary(within.aov.mod) | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | > within.aov.mod <- aov(response~factor(drug)+Error(factor(patient)), | ||
+ | > | ||
+ | > | ||
+ | > summary(within.aov.mod) | ||
+ | |||
+ | Error: factor(patient) | ||
+ | Df Sum Sq Mean Sq F value Pr(>F) | ||
+ | Residuals | ||
+ | |||
+ | Error: Within | ||
+ | Df Sum Sq Mean Sq F value | ||
+ | factor(drug) | ||
+ | Residuals | ||
+ | --- | ||
+ | Signif. codes: | ||
+ | 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | ||
+ | > | ||
+ | |||
+ | </ | ||
====== two way ====== | ====== two way ====== | ||
< | < |
repeated_measure_anova.txt · Last modified: 2024/05/01 08:27 by hkimscil