Description Usage Arguments Details Value See Also Examples
Similar to other predict methods, this functions predicts fitted
values, logits, coefficients and more from a fitted sail
object.
1 2 3 4 5 6 |
object |
Fitted |
newx |
matrix of new values for |
newe |
vector of new values for the exposure variable |
s |
Value(s) of the penalty parameter |
type |
Type of prediction required. Type |
... |
currently ignored |
R Source code file for predict, coef, plot and print methods for the sail package Author: Sahir Bhatnagar Created: 2016 Updated: April 6, 2018
s
is the new vector at which predictions are requested. If
s
is not in the lambda sequence used for fitting the model, the
predict function will use linear interpolation to make predictions. The new
values are interpolated using a fraction of predicted values from both left
and right lambda indices. coef(...)
is equivalent to
predict(sail.object, type="coefficients",...)
The object returned depends on type.
1 2 3 4 5 6 | f.basis <- function(i) splines::bs(i, degree = 3)
fit <- sail(x = sailsim$x, y = sailsim$y, e = sailsim$e,
basis = f.basis, dfmax = 5, nlambda = 10, maxit = 20)
predict(fit) # predicted response for whole solution path
predict(fit, s = 0.45) # predicted response for a single lambda value
predict(fit, s = c(2.15, 0.32, 0.40), type="nonzero") # nonzero coefficients
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.