HW5 R code

# HW5 R code - #Tukey Method data1=read.table"data3.1...

This preview shows pages 1–3. Sign up to view the full content.

Sheet1 Page 1 # #Tukey Method # data1=read.table("data3.1.txt") data1=as.matrix(data1) y=as.vector(data1) x=rep(1:4,each=4) x=factor(x) fm1=aov(y~x) fm1Tukey=TukeyHSD(fm1,"x",conf.level=0.99) plot(fm1Tukey) # #Question 2 # data=read.table("data5.2.txt",header=TRUE) data=data.frame(data) data # #Remove the first row. # data1=data[,-1] data1 data1=as.matrix(data1) y=as.vector(data1) trt=rep(1:10,each=9) bl=rep(1:9,times=10) g = lm(y~factor(trt)+factor(bl)) summary(aov(g)) Df Sum Sq Mean Sq F value Pr(>F) factor(trt) 9 1.82549 0.202832 23.6429 < 2.2e-16 *** factor(bl) 8 0.49958 0.062448 7.2791 4.902e-07 *** Residuals 72 0.61769 0.008579 --- Signif. codes: 0 ¡¥***¡¦ 0.001 ¡¥**¡¦ 0.01 ¡¥*¡¦ 0.05 ¡¥.¡¦ 0.1 ¡¥ ¡¦ 1 # #Tukey method # x=factor(trt) fm1=aov(y~x) fm1Tukey=TukeyHSD(fm1,"x",conf.level=0.95) plot(fm1Tukey) # #Question 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sheet1 Page 2 # > Ife=c(16.1,15.3,17.5,16.6,19.2,18.5,20.8,18,21) > Pusa=c(8.1,8.6,10.1,12.7,13.7,11.5,14.4,15.4,13.7) > data=cbind(Ife,Pusa) > data=as.matrix(data)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

HW5 R code - #Tukey Method data1=read.table"data3.1...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online