Learn R Programming

genlasso (version 1.2)

predict.genlasso: Make predictions given a genlasso object

Description

This predict method for the genlasso class makes a prediction for the fitted values at new predictor measurements. Hence it is really only useful when the generalized lasso model has been fit with a nonidentity predictor matrix. In the case that the predictor matrix is the identity, it does the same thing as coef.genlasso.

Usage

## S3 method for class 'genlasso':
predict(object, lambda, nlam, df, Xnew, ...)

Arguments

object
object of class "genlasso", or an object which inherits this class (i.e., "fusedlasso", "trendfilter").
lambda
a numeric vector of tuning parameter values at which coefficients should be calculated. The user can choose to specify one of lambda, nlam, or df; if none are specified, then coefficients are returned at
nlam
an integer indicating a number of tuning parameters values at which coefficients should be calculated. The tuning parameter values are then chosen to be equally spaced on the log scale over the first half of the solution path (this is if the f
df
an integer vector of degrees of freedom values at which coefficients should be calculated. In the case that a single degrees of freedom value appears multiple times throughout the solution path, the least regularized solution (corresponding t
Xnew
a numeric matrix X, containing new predictor measurements at which predictions should be made. If missing, it is assumed to be the same as the existing predictor measurements in object.
...
additional arguments passed to predict.

Value

  • Returns a list with the following components:
  • fita numeric matrix of predictor values, one column for each value of lambda.
  • lambdaa numeric vector containing the sequence of tuning parameter values, corresponding to the columns of fit.
  • dfif df was specified, an integer vector containing the sequence of degrees of freedom values corresponding to the columns of fit.

See Also

coef.genlasso