r:repeated_measures_anova
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| r:repeated_measures_anova [2020/06/03 15:49] – hkimscil | r:repeated_measures_anova [2026/04/27 04:51] (current) – [exer1] hkimscil | ||
|---|---|---|---|
| Line 167: | Line 167: | ||
| > | > | ||
| </ | </ | ||
| + | ====== e.g. 3 ====== | ||
| + | < | ||
| + | demo3 <- read.csv(" | ||
| + | ## Convert variables to factor | ||
| + | demo3 <- within(demo3, | ||
| + | group <- factor(group) | ||
| + | time <- factor(time) | ||
| + | id <- factor(id) | ||
| + | }) | ||
| + | demo3 | ||
| + | |||
| + | par(cex = .6) | ||
| + | |||
| + | with(demo3, interaction.plot(time, | ||
| + | ylim = c(10, 60), lty = c(1, 12), lwd = 3, | ||
| + | ylab = "mean of pulse", | ||
| + | |||
| + | demo3.aov <- aov(pulse ~ group * time + Error(id), data = demo3) | ||
| + | summary(demo3.aov) | ||
| + | </ | ||
| + | {{: | ||
| + | < | ||
| + | > demo3 <- read.csv(" | ||
| + | > ## Convert variables to factor | ||
| + | > demo3 <- within(demo3, | ||
| + | + group <- factor(group) | ||
| + | + time <- factor(time) | ||
| + | + id <- factor(id) | ||
| + | + }) | ||
| + | > | ||
| + | > demo3 | ||
| + | id group pulse time | ||
| + | 1 | ||
| + | 2 | ||
| + | 3 | ||
| + | 4 | ||
| + | 5 | ||
| + | 6 | ||
| + | 7 | ||
| + | 8 | ||
| + | 9 | ||
| + | 10 4 | ||
| + | 11 4 | ||
| + | 12 4 | ||
| + | 13 5 | ||
| + | 14 5 | ||
| + | 15 5 | ||
| + | 16 6 | ||
| + | 17 6 | ||
| + | 18 6 | ||
| + | 19 7 | ||
| + | 20 7 | ||
| + | 21 7 | ||
| + | 22 8 | ||
| + | 23 8 | ||
| + | 24 8 | ||
| + | > | ||
| + | > par(cex = .6) | ||
| + | > | ||
| + | > with(demo3, interaction.plot(time, | ||
| + | + ylim = c(10, 60), lty = c(1, 12), lwd = 3, | ||
| + | + ylab = "mean of pulse", | ||
| + | > | ||
| + | > demo3.aov <- aov(pulse ~ group * time + Error(id), data = demo3) | ||
| + | > summary(demo3.aov) | ||
| + | |||
| + | Error: id | ||
| + | Df Sum Sq Mean Sq F value Pr(> | ||
| + | group 1 2035.0 | ||
| + | Residuals | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | |||
| + | Error: Within | ||
| + | Df Sum Sq Mean Sq F value | ||
| + | time 2 2830.3 | ||
| + | group: | ||
| + | Residuals | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | > | ||
| + | </ | ||
| + | |||
| + | ====== e.g. 4 ====== | ||
| + | < | ||
| + | demo4 <- read.csv(" | ||
| + | ## Convert variables to factor | ||
| + | demo4 <- within(demo4, | ||
| + | group <- factor(group) | ||
| + | time <- factor(time) | ||
| + | id <- factor(id) | ||
| + | }) | ||
| + | |||
| + | demo4 | ||
| + | |||
| + | par(cex = .6) | ||
| + | |||
| + | with(demo4, interaction.plot(time, | ||
| + | ylim = c(10, 60), lty = c(1, 12), lwd = 3, | ||
| + | ylab = "mean of pulse", | ||
| + | |||
| + | demo4.aov <- aov(pulse ~ group * time + Error(id), data = demo4) | ||
| + | summary(demo4.aov) | ||
| + | |||
| + | </ | ||
| + | {{: | ||
| + | < | ||
| + | > | ||
| + | > demo4 <- read.csv(" | ||
| + | > ## Convert variables to factor | ||
| + | > demo4 <- within(demo4, | ||
| + | + group <- factor(group) | ||
| + | + time <- factor(time) | ||
| + | + id <- factor(id) | ||
| + | + }) | ||
| + | > | ||
| + | > demo4 | ||
| + | id group pulse time | ||
| + | 1 | ||
| + | 2 | ||
| + | 3 | ||
| + | 4 | ||
| + | 5 | ||
| + | 6 | ||
| + | 7 | ||
| + | 8 | ||
| + | 9 | ||
| + | 10 4 | ||
| + | 11 4 | ||
| + | 12 4 | ||
| + | 13 5 | ||
| + | 14 5 | ||
| + | 15 5 | ||
| + | 16 6 | ||
| + | 17 6 | ||
| + | 18 6 | ||
| + | 19 7 | ||
| + | 20 7 | ||
| + | 21 7 | ||
| + | 22 8 | ||
| + | 23 8 | ||
| + | 24 8 | ||
| + | > | ||
| + | > par(cex = .6) | ||
| + | > | ||
| + | > with(demo4, interaction.plot(time, | ||
| + | + ylim = c(10, 60), lty = c(1, 12), lwd = 3, | ||
| + | + ylab = "mean of pulse", | ||
| + | > | ||
| + | > demo4.aov <- aov(pulse ~ group * time + Error(id), data = demo4) | ||
| + | > summary(demo4.aov) | ||
| + | |||
| + | Error: id | ||
| + | Df Sum Sq Mean Sq F value | ||
| + | group 1 2542.0 | ||
| + | Residuals | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | |||
| + | Error: Within | ||
| + | Df Sum Sq Mean Sq F value | ||
| + | time 2 1 | ||
| + | group: | ||
| + | Residuals | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | > | ||
| + | </ | ||
| + | |||
| + | ====== exer1 ====== | ||
| + | < | ||
| + | exer1 <- read.csv(" | ||
| + | str(exer1) | ||
| + | exer1 <- within(exer1, | ||
| + | diet <- factor(diet) | ||
| + | exertype <- factor(exertype) | ||
| + | time <- factor(time) | ||
| + | id <- factor(id) | ||
| + | }) ## 이제 pulse만 제외하고 모두 factor로 변환된 데이터 | ||
| + | |||
| + | str(exer1) | ||
| + | with(exer1, interaction.plot(time, | ||
| + | ylim = c(80, 120), lty = c(1, 12), lwd = 3, | ||
| + | ylab = "mean of pulse", | ||
| + | with(exer1, interaction.plot(time, | ||
| + | ylim = c(80, 120), lty = c(1, 12), lwd = 3, | ||
| + | ylab = "mean of pulse", | ||
| + | with(exer1, interaction.plot(exertype, | ||
| + | ylim = c(80, 120), lty = c(1, 12), lwd = 3, | ||
| + | ylab = "mean of pulse", | ||
| + | |||
| + | |||
| + | exer1a.aov <- aov(pulse ~ exertype * time + Error(id/ | ||
| + | summary(exer1a.aov) | ||
| + | |||
| + | exer1b.aov <- aov(pulse ~ diet * time + Error(id/ | ||
| + | summary(exer1b.aov) | ||
| + | |||
| + | exer1c.aov <- aov(pulse ~ diet * exertype, data = exer1) | ||
| + | summary(exer1c.aov) | ||
| + | </ | ||
| + | < | ||
| + | > exer1 <- read.csv(" | ||
| + | > str(exer1) | ||
| + | ' | ||
| + | $ id : int 1 1 1 2 2 2 3 3 3 4 ... | ||
| + | $ diet : int 1 1 1 1 1 1 1 1 1 1 ... | ||
| + | $ exertype: int 1 1 1 1 1 1 1 1 1 1 ... | ||
| + | $ pulse : int 85 85 88 90 92 93 97 97 94 80 ... | ||
| + | $ time : int 1 2 3 1 2 3 1 2 3 1 ... | ||
| + | > exer1 <- within(exer1, | ||
| + | + diet <- factor(diet) | ||
| + | + | ||
| + | + time <- factor(time) | ||
| + | + id <- factor(id) | ||
| + | + }) ## 이제 pulse만 제외하고 모두 factor로 변환된 데이터 | ||
| + | > | ||
| + | > str(exer1) | ||
| + | ' | ||
| + | $ id : Factor w/ 30 levels " | ||
| + | $ diet : Factor w/ 2 levels " | ||
| + | $ exertype: Factor w/ 3 levels " | ||
| + | $ pulse : int 85 85 88 90 92 93 97 97 94 80 ... | ||
| + | $ time : Factor w/ 3 levels " | ||
| + | > with(exer1, interaction.plot(time, | ||
| + | + ylim = c(80, 120), lty = c(1, 12), lwd = 3, | ||
| + | + ylab = "mean of pulse", | ||
| + | > with(exer1, interaction.plot(time, | ||
| + | + ylim = c(80, 120), lty = c(1, 12), lwd = 3, | ||
| + | + ylab = "mean of pulse", | ||
| + | > | ||
| + | > with(exer1, interaction.plot(exertype, | ||
| + | + ylim = c(80, 120), lty = c(1, 12), lwd = 3, | ||
| + | + ylab = "mean of pulse", | ||
| + | > | ||
| + | > | ||
| + | > exer1a.aov <- aov(pulse ~ exertype * time + Error(id/ | ||
| + | > summary(exer1a.aov) | ||
| + | |||
| + | Error: id | ||
| + | Df Sum Sq Mean Sq F value | ||
| + | exertype | ||
| + | Residuals 27 | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | |||
| + | Error: id:time | ||
| + | Df Sum Sq Mean Sq F value | ||
| + | time | ||
| + | exertype: | ||
| + | Residuals | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | > | ||
| + | > exer1b.aov <- aov(pulse ~ diet * time + Error(id/ | ||
| + | > summary(exer1b.aov) | ||
| + | |||
| + | Error: id | ||
| + | Df Sum Sq Mean Sq F value Pr(> | ||
| + | diet | ||
| + | Residuals 28 11227 | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | |||
| + | Error: id:time | ||
| + | Df Sum Sq Mean Sq F value | ||
| + | time | ||
| + | diet: | ||
| + | Residuals 56 | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | > | ||
| + | > exer1c.aov <- aov(pulse ~ diet * exertype, data = exer1) | ||
| + | > summary(exer1c.aov) | ||
| + | Df Sum Sq Mean Sq F value | ||
| + | diet | ||
| + | exertype | ||
| + | diet: | ||
| + | Residuals | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | > | ||
| + | </ | ||
| + | {{.: | ||
| + | {{.: | ||
| + | {{.: | ||
| + | < | ||
| + | > exer1 | ||
| + | id diet exertype pulse time | ||
| + | 1 | ||
| + | 2 | ||
| + | 3 | ||
| + | 4 | ||
| + | 5 | ||
| + | 6 | ||
| + | 7 | ||
| + | 8 | ||
| + | 9 | ||
| + | 10 4 1 1 80 1 | ||
| + | 11 4 1 1 82 2 | ||
| + | 12 4 1 1 83 3 | ||
| + | 13 5 1 1 91 1 | ||
| + | 14 5 1 1 92 2 | ||
| + | 15 5 1 1 91 3 | ||
| + | 16 6 2 1 83 1 | ||
| + | 17 6 2 1 83 2 | ||
| + | 18 6 2 1 84 3 | ||
| + | 19 7 2 1 87 1 | ||
| + | 20 7 2 1 88 2 | ||
| + | 21 7 2 1 90 3 | ||
| + | 22 8 2 1 92 1 | ||
| + | 23 8 2 1 94 2 | ||
| + | 24 8 2 1 95 3 | ||
| + | 25 9 2 1 97 1 | ||
| + | 26 9 2 1 99 2 | ||
| + | 27 9 2 1 96 3 | ||
| + | 28 10 2 1 | ||
| + | 29 10 2 1 97 2 | ||
| + | 30 10 2 1 | ||
| + | 31 11 1 2 86 1 | ||
| + | 32 11 1 2 86 2 | ||
| + | 33 11 1 2 84 3 | ||
| + | 34 12 1 2 93 1 | ||
| + | 35 12 1 2 | ||
| + | 36 12 1 2 | ||
| + | 37 13 1 2 90 1 | ||
| + | 38 13 1 2 92 2 | ||
| + | 39 13 1 2 93 3 | ||
| + | 40 14 1 2 95 1 | ||
| + | 41 14 1 2 96 2 | ||
| + | 42 14 1 2 | ||
| + | 43 15 1 2 89 1 | ||
| + | 44 15 1 2 96 2 | ||
| + | 45 15 1 2 95 3 | ||
| + | 46 16 2 2 84 1 | ||
| + | 47 16 2 2 86 2 | ||
| + | 48 16 2 2 89 3 | ||
| + | 49 17 2 2 | ||
| + | 50 17 2 2 | ||
| + | 51 17 2 2 90 3 | ||
| + | 52 18 2 2 92 1 | ||
| + | 53 18 2 2 96 2 | ||
| + | 54 18 2 2 | ||
| + | 55 19 2 2 97 1 | ||
| + | 56 19 2 2 98 2 | ||
| + | 57 19 2 2 | ||
| + | 58 20 2 2 | ||
| + | 59 20 2 2 | ||
| + | 60 20 2 2 | ||
| + | 61 21 1 3 93 1 | ||
| + | 62 21 1 3 98 2 | ||
| + | 63 21 1 3 | ||
| + | 64 22 1 3 98 1 | ||
| + | 65 22 1 3 | ||
| + | 66 22 1 3 | ||
| + | 67 23 1 3 98 1 | ||
| + | 68 23 1 3 | ||
| + | 69 23 1 3 99 3 | ||
| + | 70 24 1 3 87 1 | ||
| + | 71 24 1 3 | ||
| + | 72 24 1 3 | ||
| + | 73 25 1 3 94 1 | ||
| + | 74 25 1 3 | ||
| + | 75 25 1 3 | ||
| + | 76 26 2 3 95 1 | ||
| + | 77 26 2 3 | ||
| + | 78 26 2 3 | ||
| + | 79 27 2 3 | ||
| + | 80 27 2 3 | ||
| + | 81 27 2 3 | ||
| + | 82 28 2 3 | ||
| + | 83 28 2 3 | ||
| + | 84 28 2 3 | ||
| + | 85 29 2 3 94 1 | ||
| + | 86 29 2 3 | ||
| + | 87 29 2 3 | ||
| + | 88 30 2 3 99 1 | ||
| + | 89 30 2 3 | ||
| + | 90 30 2 3 | ||
| + | > | ||
| + | </ | ||
r/repeated_measures_anova.1591199365.txt.gz · Last modified: by hkimscil
