A1Solution.pdf - STAT 359\/563 Assignment 1 Solution 1 X.x hours 2 Plant growth data Growth=read.table(file=\"plants header=TRUE Growth(a dataframe

# A1Solution.pdf - STAT 359/563 Assignment 1 Solution 1 X.x...

• 5

This preview shows page 1 - 3 out of 5 pages.

STAT 359/563 Assignment 1 Solution 1. X.x hours 2. Plant growth data Growth=read.table(file="plants.txt", header=TRUE) Growth #(a) dataframe attach(Growth) Growth obs growth treatment Plot Pot 1 1 14.6 1 1 1 2 2 15.2 1 1 1 3 3 13.2 1 1 2 4 4 12.9 1 1 2 5 5 16.4 1 1 3 6 6 12.2 1 1 3 7 7 7.1 2 2 4 8 8 7.7 2 2 4 9 9 6.8 2 2 5 10 10 6.0 2 2 5 11 11 10.0 2 2 6 12 12 8.3 2 2 6 13 13 18.5 1 3 7 14 14 16.7 1 3 7 15 15 22.2 1 3 8 16 16 18.8 1 3 8 17 17 24.7 1 3 9 18 18 20.3 1 3 9 19 19 9.7 2 4 10 20 20 8.8 2 4 10 21 21 6.8 2 4 11 22 22 9.2 2 4 11 23 23 10.4 2 4 12 24 24 10.5 2 4 12 #(b) sort growth s1=order(growth) Growth[s1,] obs growth treatment Plot Pot 10 10 6.0 2 2 5 9 9 6.8 2 2 5 21 21 6.8 2 4 11 7 7 7.1 2 2 4 8 8 7.7 2 2 4 12 12 8.3 2 2 6 20 20 8.8 2 4 10 22 22 9.2 2 4 11 19 19 9.7 2 4 10 11 11 10.0 2 2 6 23 23 10.4 2 4 12 24 24 10.5 2 4 12 6 6 12.2 1 1 3 4 4 12.9 1 1 2 3 3 13.2 1 1 2 1 1 14.6 1 1 1 2 2 15.2 1 1 1 5 5 16.4 1 1 3
14 14 16.7 1 3 7 13 13 18.5 1 3 7 16 16 18.8 1 3 8 18 18 20.3 1 3 9 15 15 22.2 1 3 8 17 17 24.7 1 3 9 #(c) the mean and variance > mean(growth) [1] 12.79167 > var(growth) [1] 28.12428 #(d) histogram hist(growth, main="Plant growth distribution",xlab="growth (mm)", breaks=c(0:10)*2+5,xlim=c(5,27),col="yellow")