set.seed(1234)
x<-seq(0,10,length=200); y<-(yt<-1+2*x+.6*x^2-.1*x^3)+rnorm(200,0, 16)
yts <- ts(y)
plot(yts)
#---------------------------------------------------------
#lambda fix
m1<-penLS(yts,lambda=1) ; deviance(m1)
#---------------------------------------------------------
# fixing df
m2<-penLS(yts, df=10) ; deviance(m2)
#---------------------------------------------------------
# estimating lambda - ML
m3<-penLS(yts) ; deviance(m3)
#---------------------------------------------------------
# estimating lambda - GAIC
m4<-penLS(yts, method="GAIC", k=3) ; deviance(m4)
#---------------------------------------------------------
# different order
PPP <- par(mfrow=c(2,2))
penLS(yts, plot=TRUE, order=0, main="order=0")
penLS(yts, plot=TRUE, order=1, main="order=1")
penLS(yts, plot=TRUE, order=2, main="order=2")
penLS(yts, plot=TRUE, order=3, main="order=3")
par(PPP)
Run the code above in your browser using DataLab