data(yccalp)
okp = options()
options(verbose=TRUE)
dem = smoothExp( yccalp[1:20,], "minutes", keepAt=seq(0,120,5), igran=5)
plot(dem[[1]])
dem2 = smoothExp( yccalp[1:20,], "minutes", keepAt=seq(0,120,5),
fitter=locfit::locfit, fmla=y~lp(x,nn=.4),dogcv.locfit=TRUE, igran=5)
plot(dem2[[1]])
dem3 = smoothExp( yccalp[1:20,], "minutes", keepAt=seq(0,120,5),
fitter=locfit::locfit, fmla=y~lp(x,nn=.4),dogcv.locfit=FALSE,
exclind=c(3,6,9,12,15), pv=varfitFIX(locfit::locfit,
y~lp(x,nn=.4), c(3,6,9,12,15)), igran=5)
plot(dem3[[1]])
pv2 = gcvs(dem2) # get locfit gcv est
pv3 = extract(dem3, "predvar") # use the fixed test points est
ipar = par(no.readonly=TRUE)
par(mfrow=c(2,2))
plot(pv2,pv3)
pv3
bes3 = names(sort(pv3))[1]
plot(dem2[[bes3]], main="full data fit")
plot(dem3[[bes3]], main="leave 5 out fit, x=test point")
par(ipar)
options(okp)
Run the code above in your browser using DataLab