This preview shows pages 1–5. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: plot ( x1 , y1 , pch = 2 , col = "blue" ) points ( x , y ) d1 = seq ( min ( x1 ), max ( x1 ), length = 200 ) for ( degree in 1 : 9 ){ fm = lm ( y ~ poly ( x , degree )) assign ( paste ( "y" , degree , sep = "." ), fm ) lines ( d , predict ( fm , data.frame ( x = d1 )), lty =( degree + 1 )) } ## some of the error is due to extrapolation ## try plotting mse1 and mse2 including only test points ## that fall within the original range of the x's1 1 21.00.5 0.0 0.5 1.0 1.5 2.0 x y 2 4 6 8 1 10 100 1000 10000 poly degree mse21 1 2 3321 1 2 x1 y1...
View
Full
Document
This document was uploaded on 08/12/2010.
 Spring '09

Click to edit the document details