r:factorial_anova
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| r:factorial_anova [2026/04/14 23:34] – hkimscil | r:factorial_anova [2026/04/28 13:32] (current) – [output interpretation] hkimscil | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Two-way ANOVA ====== | ====== Two-way ANOVA ====== | ||
| Factorial ANOVA 라고도 부른다. | Factorial ANOVA 라고도 부른다. | ||
| + | <tabbox rs.two.way.anova> | ||
| < | < | ||
| rm(list=ls(all=TRUE)) | rm(list=ls(all=TRUE)) | ||
| Line 201: | Line 202: | ||
| las = 2 # rotate x-axis ticks | las = 2 # rotate x-axis ticks | ||
| ) | ) | ||
| + | m.a <- tapply(y, a, mean) | ||
| + | m.b <- tapply(y, b, mean) | ||
| + | |||
| + | with(dat, interaction.plot(a, | ||
| + | points(x=1, y=m.a[1], col=' | ||
| + | points(x=2, y=m.a[2], col=' | ||
| + | points(x=3, y=m.a[3], col=' | ||
| + | text(x=1, y=m.a[1], pos=3, col=' | ||
| + | text(x=2, y=m.a[2], pos=3, col=' | ||
| + | text(x=3, y=m.a[3], pos=3, col=' | ||
| + | |||
| + | with(dat, interaction.plot(b, | ||
| + | points(x=1, y=m.b[1], col=' | ||
| + | points(x=2, y=m.b[2], col=' | ||
| + | text(x=1, y=m.b[1], pos=3, col=' | ||
| + | text(x=2, y=m.b[2], pos=3, col=' | ||
| Line 209: | Line 226: | ||
| # | # | ||
| # | # | ||
| - | |||
| </ | </ | ||
| - | ====== Output, | + | <tabbox ro.two.way.anova> |
| < | < | ||
| > rm(list=ls(all=TRUE)) | > rm(list=ls(all=TRUE)) | ||
| Line 668: | Line 684: | ||
| > | > | ||
| > | > | ||
| + | |||
| </ | </ | ||
| + | |||
| + | </ | ||
| ====== output interpretation ====== | ====== output interpretation ====== | ||
| Line 675: | Line 694: | ||
| {{: | {{: | ||
| {{: | {{: | ||
| - | {{:c:ms:2025:pasted:20250430-124435.png}} | + | {{.:pasted:20260428-131628.png}} |
| 상호작용효과 포함 해석 | 상호작용효과 포함 해석 | ||
| * drug1의 효과에 운동의 역할은 아주 중요한 것으로 밝혀졌다. | * drug1의 효과에 운동의 역할은 아주 중요한 것으로 밝혀졌다. | ||
| Line 688: | Line 706: | ||
| * 운동이 병행된 drg1과 drg3의 | * 운동이 병행된 drg1과 drg3의 | ||
| * drg2의 운동유무, | * drg2의 운동유무, | ||
| - | + | {{.:pasted:20260428-131558.png}} | |
| - | {{:c:ms:2025:pasted:20250430-130525.png}} | + | < |
| + | > m.lm <- (lm(y~a*b, data = dat)) | ||
| + | > summary(m.lm) | ||
| + | |||
| + | Call: | ||
| + | lm(formula = y ~ a * b, data = dat) | ||
| + | |||
| + | Residuals: | ||
| + | Min 1Q Median | ||
| + | -1.9469 -0.4908 -0.1742 | ||
| + | |||
| + | Coefficients: | ||
| + | | ||
| + | (Intercept) | ||
| + | adrg2 0.8050 | ||
| + | adrg3 0.6943 | ||
| + | bexerc | ||
| + | adrg2: | ||
| + | adrg3: | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | ||
| + | |||
| + | Residual standard error: 1.016 on 24 degrees of freedom | ||
| + | Multiple R-squared: | ||
| + | F-statistic: | ||
| + | |||
| + | > anova(m.lm) | ||
| + | Analysis of Variance Table | ||
| + | |||
| + | Response: y | ||
| + | Df Sum Sq Mean Sq F value Pr(> | ||
| + | a 2 12.566 | ||
| + | b 1 12.107 12.1069 11.7176 0.0022274 ** | ||
| + | a:b 2 25.740 12.8699 12.4561 0.0001948 *** | ||
| + | Residuals 24 24.797 | ||
| + | --- | ||
| + | Signif. codes: | ||
| + | 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | ||
| + | > | ||
| + | |||
| + | > ss.tot <- sum(anova(m.lm)[2]) | ||
| + | > ss.a <- anova(m.lm)[[2]][1] | ||
| + | > ss.b <- anova(m.lm)[[2]][2] | ||
| + | > ss.ab <- anova(m.lm)[[2]][3] | ||
| + | > ss.bet <- ss.a + ss.b + ss.ab | ||
| + | > ss.bet | ||
| + | [1] 50.41308 | ||
| + | > ss.tot | ||
| + | [1] 75.21048 | ||
| + | > ss.bet / ss.tot | ||
| + | [1] 0.6702933 | ||
| + | > | ||
| + | |||
| + | </ | ||
r/factorial_anova.1776209660.txt.gz · Last modified: by hkimscil
