Michael|12.3 ANCOVA with two factors and one continuous covariate
Gain <- read.table("c:\\temp\\Gain.txt",header=T)
attach(Gain)
names(Gain)
m1 <- lm(Weight~Sex*Age*Genotype)
summary(m1)
m2 <- step(m1)
summary(m2)
newGenotype <- Genotype
levels(newGenotype)
levels(newGenotype)[c(3,5)] <- "ClonesCandE"
levels(newGenotype)[c(2,4)] <- "ClonesBandD"
levels(newGenotype)
m3 <- lm(Weight~Sex+Age+newGenotype)
anova(m2,m3)
【Michael|12.3 ANCOVA with two factors and one continuous covariate】summary(m3)
plot(Age,Weight,type="n")
colours <- c("green","red","black","blue")
lines <- c(1,2)
symbols <- c(16,17)
points(Age,Weight,pch=symbols[as.numeric(Sex)],
col=colours[as.numeric(newGenotype)])
xv <- c(1,5)
for (i in 1:2) {
for (j in 1:4) {
a <- coef(m3)[1]+(i>1)* coef(m3)[2]+(j>1)*coef(m3)[j+2]
b <- coef(m3)[3]
yv <- a+b*xv
lines(xv,yv,lty=lines[i],col=colours[j]) } }
推荐阅读
- 2017.12.3|2017.12.3 深圳湾看海
- 晨间日记|晨间日记 12.30日
- 亲子日记第330天
- 12.30日精进
- 跨年随想
- 还在为这个夏天升级哪款包包而苦恼(行走的种草机杨幂早就为我们种好了这些草——Michael|还在为这个夏天升级哪款包包而苦恼?行走的种草机杨幂早就
- 2017.12.31
- 【2018.12.3】“女儿,我劝你不要轻易当全职妈妈”
- Dart|Dart 2.15 现已发布
- 2017.12.30#每日复盘#|2017.12.30#每日复盘# DAY46--得到是为了给予