cv.sail
objectpredict.cv.sail.Rd
This function makes predictions from a cross-validated sail model, using the stored "sail.fit" object, and the optimal value chosen for lambda.
# S3 method for cv.sail predict(object, newx, newe, s = c("lambda.1se", "lambda.min"), ...) # S3 method for cv.sail coef(object, s = c("lambda.1se", "lambda.min"), ...)
object | fitted |
---|---|
newx | matrix of new values for |
newe | vector of new values for the exposure variable |
s | Value(s) of the penalty parameter |
... | other arguments passed to |
The object returned depends the ... argument which is passed on to
the predict method for sail
objects.
This function makes it easier to use the results of cross-validation to make a prediction.
if (FALSE) { if(interactive()){ data("sailsim") f.basis <- function(i) splines::bs(i, degree = 3) cvfit <- cv.sail(x = sailsim$x[,1:20,drop=F], y = sailsim$y, e = sailsim$e, basis = f.basis, nfolds = 10) predict(cvfit) # predict at "lambda.1se" predict(cvfit, s = "lambda.min") # predict at "lambda.min" predict(cvfit, s = 0.5) # predict at specific value of lambda predict(cvfit, type = "nonzero") # non-zero coefficients at lambda.1se } }