ex = expectile.laws(dist ~ base(speed),data=cars,smooth="a",lambda=5)
ex = expectile.sheets(dist ~ base(speed),data=cars,smooth="f",lambda=5)
plot(ex)
data("lidar", package = "SemiPar")
explaws <- expectile.laws(logratio~base(range,"pspline"),data=lidar,smooth="acv",expectiles=c(0.05,0.25,0.5,0.75,0.95))
print(explaws)
plot(explaws)
###expectile regression using a fixed penalty
plot(expectile.laws(logratio~base(range,"pspline"),data=lidar,smooth="fixed",lambda=1,expectiles=c(0.05,0.25,0.5,0.75,0.95)))
plot(expectile.laws(logratio~base(range,"pspline"),data=lidar,smooth="fixed",lambda=0.0000001,expectiles=c(0.05,0.25,0.5,0.75,0.95)))
#As can be seen in the plot, a too small penalty causes overfitting of the data.
plot(expectile.laws(logratio~base(range,"pspline"),data=lidar,smooth="fixed",lambda=50,expectiles=c(0.05,0.25,0.5,0.75,0.95)))
#If the penalty parameter is chosen too large, the expectile curves are smooth but don't represent the data anymore.
Run the code above in your browser using DataLab