c:ma:2019:lecturer
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
c:ma:2019:lecturer [2019/10/03 07:11] – [anova: mtcars] hkimscil | c:ma:2019:lecturer [2019/10/04 11:28] (current) – [anova: mtcars] hkimscil | ||
---|---|---|---|
Line 231: | Line 231: | ||
} | } | ||
- | data <- mtcars | + | library(MASS) |
- | x <- mtcars$am | + | |
- | y <- mtcars$mpg | + | tempd <- iris |
+ | x <- tempd$Species | ||
+ | y <- tempd$Sepal.Width | ||
+ | |||
+ | tempd <- mtcars | ||
+ | x <- tempd$gear | ||
+ | y <- tempd$mpg | ||
+ | |||
+ | tempd <- mtcars | ||
+ | x <- tempd$am | ||
+ | y <- tempd$mpg | ||
x <- factor(x) | x <- factor(x) | ||
Line 245: | Line 256: | ||
ssbetween <- sstotal-sswithin | ssbetween <- sstotal-sswithin | ||
- | round(sswithin, | + | round(sswithin, |
- | round(ssbetween, | + | round(ssbetween, |
- | round(sstotal, | + | round(sstotal, |
dfwithin <- sum(stats[4, | dfwithin <- sum(stats[4, | ||
Line 260: | Line 271: | ||
mstotal <- sstotal / dftotal | mstotal <- sstotal / dftotal | ||
- | round(mswithin, | + | round(mswithin, |
- | round(msbetween, | + | round(msbetween, |
- | round(mstotal, | + | round(mstotal, |
fval <- round(msbetween/ | fval <- round(msbetween/ | ||
Line 269: | Line 280: | ||
siglevel | siglevel | ||
- | mod <- aov(y~x, data=data) | + | mod <- aov(y~x, data=tempd) |
summary(mod) | summary(mod) | ||
c/ma/2019/lecturer.1570054276.txt.gz · Last modified: 2019/10/03 07:11 by hkimscil