#t-test and a linear model
t.test(extra ~ group,data=sleep,var.equal=T)
summary(lm(extra ~group,data=sleep))
#paired t-test
t.test(extra ~ group,data=sleep,paired=T)
summary(lm(extra ~group+ID,data=sleep))
#t-test and anova
t.test(extra ~ group,data=sleep,var.equal=T)
summary(aov(extra ~ group,data=sleep))
#one way anova and a linear model
summary(aov(len~factor(dose),ToothGrowth))
summary(lm(len~factor(dose),ToothGrowth))
(ID:15571176)
下のRコードを実行してみてくださいな
#t-test and a linear model
t.test(extra ~ group,data=sleep,var.equal=T)
summary(lm(extra ~group,data=sleep))
#paired t-test
t.test(extra ~ group,data=sleep,paired=T)
summary(lm(extra ~group+ID,data=sleep))
#t-test and anova
t.test(extra ~ group,data=sleep,var.equal=T)
summary(aov(extra ~ group,data=sleep))
#one way anova and a linear model
summary(aov(len~factor(dose),ToothGrowth))
summary(lm(len~factor(dose),ToothGrowth))