Homework 3 - Google Sites

2 downloads 281 Views 162KB Size Report
Lecture 6: Programming in R. 1) Load the warpbreaks data set and attach it.* This data set gives the number of warp brea
Homework 4

SOLUTIONS CS&SS 508 Winter 2012 Assigned: Feb. 17 Due: Mar. 2 Please submit code and output for all questions except those marked with an asterisk (*). For questions marked with an asterisk submit code only.

Lecture 6: Programming in R 1) Load the warpbreaks ) > vec3 [1] "redhead" Use the paste() function to create your factor variable, which takes the values “AL”, “AM”, “AH”, “BL”, “BM”, “BH”. > wooltension = as.factor( paste(wool, tension, sep="")) > table(wooltension) wooltension AH AL AM BH BL BM 9 9 9 9 9 9 4 b) Use the tapply() function to compute the mean number of breaks separately for each combination of wool type and tension level. > tapply(breaks, wooltension, mean) AH AL AM BH BL BM 24.55556 44.55556 24.00000 18.77778 28.22222 28.77778 > 5) The following code computes bootstrapped standard errors for a regression model from the swiss )