recitation 2 april 23
DESCRIPTION
Recitation 2 April 23. Natural Cubic Splines P enalized Cubic R egression Splines. Natural Cubic Splines. Cubic splines. sm.spline () in library “ pspline ” How to choose a smoothing parameter by OCV score: sm.spline ( x= , y= , cv= TRUE ) - PowerPoint PPT PresentationTRANSCRIPT
RECITATION 2APRIL 23
Natural Cubic SplinesPenalized Cubic Regression Splines
Natural Cubic Splines
• sm.spline() in library “pspline”• How to choose a smoothing parameter
• by OCV score: sm.spline(x= , y= , cv= TRUE)• by GCV score: sm.spline(x= , y= , cv= FALSE)
• R demo 1
Cubic splines
NCS -- linearity beyond boundary
Penalized Cubic Regression Splines
• gam() in library “mgcv”
• gam( y ~ s(x, bs=“cr”, k=n.knots) , data = dataset)
• Find the optimal smoothing parameter• By default, only select smoothing parameter by GCV score
• R demo 2