Prediction and Other Methods for 'lassogrp' Objects

Share:

Description

Compute fitted values or predictions for "lassogrp" objects (typically resulting from lasso()), or get (“extract”) other information from such an object.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'lassogrp'
fitted(object, ...)

## S3 method for class 'lassogrp'
predict(object, newdata = NULL,
  type = c("link", "response"), na.action = na.pass, ...)

## S3 method for class 'lassogrp'
formula(x, ...)

Arguments

object,x

an object of class "lassogrp", containing a lasso fit

newdata

data.frame containing the new regressors for which the predictions are required.

type

type of prediction

na.action

action for missing values, see lm.

...

not used (needed for compatibility)

Details

The fitted values are equal to response predictions for the observations used for fitting.

Value

matrix of fitted or predicted values. Columns correspond to lambda values, rows, to observations in newdata.

Author(s)

Werner Stahel, stahel@stat.math.ethz.ch

Examples

1
2
3
4
5
6
data(asphalt)
dd <- asphalt
rr <- lasso(log10(RUT)~log10(VISC)+ASPH+BASE+FINES+VOIDS+RUN, data=dd)
fitted(rr)
predict(rr, newdata=
  data.frame(VISC=2, ASPH=5, BASE=5, VOIDS=5, FINES=70, RUN=1))