Description Usage Arguments Details Value See Also Examples
Takes a fitted sail object produced by sail()
or
cv.sail()$sail.fit
and plots the component smooth function for a
prespecified variable at a given value of lambda and on the scale of the
linear predictor. Currently only implemented for type="gaussian"
1 2 
object 
a fitted 
x 
original data supplied to the original call to 
xvar 
a character corresponding to the predictor to be plotted. Only
one variable name should be supplied, if more than one is supplied, only
the first element will be plotted. This variable name must be in

s 
a single value of the penalty parameter 
f.truth 
true function. Only used for simulation purposes when the
truth is known. The function takes as a input a numeric vector
corresponding the 
col 
color of the line. The first element corresponds to the color used
for the estimated function and the second element is for the true function
(if 
legend.position 
position of the legend. Only used when 
rug 
adds a rug representation (1d plot) of the data to the plot, logical. Default: TRUE. 
... 
other graphical paramters passed to 
The linear predictor basis(xvar) * β_xvar is
plotted against xvar
, where basis
is the expansion provided
in the original call to sail
.
A plot is produced and nothing is returned
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  f.basis < function(i) splines::bs(i, degree = 3)
# Parallel
library(doParallel)
cl < makeCluster(2)
registerDoParallel(cl)
cvfit < cv.sail(x = sailsim$x, y = sailsim$y, e = sailsim$e,
parallel = TRUE, nlambda = 10,
maxit = 100, basis = f.basis,
nfolds = 3, dfmax = 10)
stopCluster(cl)
# plot cverror curve
plot(cvfit)
# nonzero estimated coefficients at lambda.min
predict(cvfit, type = "nonzero", s="lambda.min")
# plot main effect for X4 with a line for the truth also
plotMain(cvfit$sail.fit, x = sailsim$x, xvar = "X4",
s = cvfit$lambda.min, f.truth = sailsim$f4)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.