{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

R Code for HW3 - R Code for HW3 Problem 3.18...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
# R Code for HW3 Sta108, Fall 2007, Utts # Problem 3.18 Data = read.table ( "CH03PR18.txt" ) names ( Data )= c ( "Y" , "X" ) #(a) plot ( Data $ X , Data $ Y , main = "Production Time" , xlab = "Production Lot Size" , ylab = "Production Time (Hours)" , pch = 19 ) #(b) #transform Data: X'=sqrt(X) Data = cbind ( Data , sqrtX = sqrt ( Data $ X )) #fit new model with X' Fit = lm ( Y ~ sqrtX , data = Data ) summary ( Fit ) #(c) #plot the estimated regression line plot ( Data $ sqrtX , Data $ Y , main = "Transformed Plot of Production Time" , xlab = "Square-Root Production Lot Size" , ylab = "Production Time (Hours)" , pch = 19 ) abline ( Fit $ coefficients [ 1 ], Fit $ coefficients [ 2 ]) #(d) #print residuals and fitted values to the screen cbind ( ei = Fit $ residuals , Yhat = Fit $ fitted.values
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}