assn1_solns.doc - Stat 359\/563 Assignment 1 Solutions Thank you to Dr Laura Cowen for developing most of the solutions presented here Note that as you

# assn1_solns.doc - Stat 359/563 Assignment 1 Solutions...

• 4
• 100% (1) 1 out of 1 people found this document helpful

This preview shows page 1 - 2 out of 4 pages.

Stat 359/563 Assignment 1 Solutions Thank you to Dr. Laura Cowen for developing most of the solutions presented here. Note that as you are programming, solutions tend to be unique to the individual and there are many ways to solve the same problem. Here are my solutions. 2 a) Arrange the data so that each row represents one experimental unit or one response. Columns represent response variables and explanatory variables. yield<- read.table(“d:\\Stat359\\Assignment1\\plots.txt”, header=T) yield growth trt plot pot 1 14.6 1 1 1 2 15.2 1 1 1 3 13.2 1 1 2 4 12.9 1 1 2 5 16.4 1 1 3 6 12.2 1 1 3 7 7.1 2 2 4 8 7.7 2 2 4 9 6.8 2 2 5 10 6.0 2 2 5 11 10.0 2 2 6 12 8.3 2 2 6 13 18.5 1 3 7 14 16.7 1 3 7 15 22.2 1 3 8 16 18.8 1 3 8 17 24.7 1 3 9 18 20.3 1 3 9 19 9.7 2 4 10 20 8.8 2 4 10 21 6.8 2 4 11 22 9.0 2 4 11 23 10.4 2 4 12 24 11.3 2 4 12 b) Sort by growth. attach(yield) sort(growth) [1] 6.0 6.8 6.8 7.1 7.7 8.3 8.8 9.0 9.7 10.0 10.4 11.3 12.2 12.9 13.2 [16] 14.6 15.2 16.4 16.7 18.5 18.8 20.3 22.2 24.7 If I wanted to do the entire data.frame I could use o<-order(growth) yield2<-cbind(growth[o], trt[o], plot[o], pot[o]) [,1] [,2] [,3] [,4] [1,] 6.0 2 2 5 [2,] 6.8 2 2 5 [3,] 6.8 2 4 11 [4,] 7.1 2 2 4 [5,] 7.7 2 2 4 [6,] 8.3 2 2 6 [7,] 8.8 2 4 10 [8,] 9.0 2 4 11 [9,] 9.7 2 4 10 [10,] 10.0