わーい。乱かい法とか知らないで、二元分散分析やったったけど、気にしないぞー。
a1 <- c(12,12.7,13.3,11.3,14.7,15.0) a2 <- c(12.0,14.3,14.7,13.7,16.3,16.0) a3 <- c(15.3,16.0,18.3,15.7,20.0,20.3) a4 <- c(11.3,13.7,14.3,11.3,14.7,15.7) A <- factor(c(rep("a1",6),rep("a2",6),rep("a3",6),rep("a4",6))) B <- rep(c("b1","b2","b3"),8) y <- c(a1,a2,a3,a4) bunsan <- data.frame(A,B,y) summary(aov(y~A+B,data=bunsan)) ab <- c() for(i in 1:3){ ab[4*(i-1)+1] <- (a1[i]+a1[i+3])/2 ab[4*(i-1)+2] <- (a2[i]+a2[i+3])/2 ab[4*(i-1)+3] <- (a3[i]+a3[i+3])/2 ab[4*(i-1)+4] <- (a4[i]+a4[i+3])/2 } mat <- matrix(ab,3,4,byrow=T) colnames <- c("A1","A2","A3","A4") colnames(mat) <- colnames rownames <- c("B1","B2","B3") rownames(mat) <- rownames par(mar=c(6,6,6,3)) matplot(t(mat),type="b",pch=21,xlab="接着温度",ylab="プレス圧",axes=F,col=c("#1E5692", "#3E9A3B", "#F9A015"),lwd=5,cex=2,lty=1) my.col=c("darkorchid1","cyan3","aquamarine3") par(xpd=TRUE) title(main="データのグラフ化") rownames legend(1, max(mat), legend=rownames, col=my.col, lty=c(1:3), pch=c(3,2,1) ) t(cbind(a1,a2,a3,a4)) matpoints(t(cbind(a1,a2,a3,a4)),pch=c(3,2,1),col=my.col) for(i in 1:3){ segments(1,a1[i],1,a1[i+3],lty=2) segments(2,a2[i],2,a2[i+3],lty=2) segments(3,a3[i],3,a3[i+3],lty=2) segments(4,a4[i],4,a4[i+3],lty=2) } axis(1,1:4,colnames,) axis(2)