extract.lassogrp {lassogrp} | R Documentation |
Extract a regression fits from a lasso fit (table).
extract.lassogrp(object, i = NULL, lambda = NULL, data=NULL, fitfun = "lm", ...) ## S3 method for class 'lassogrp' x[i]
object, x |
an object of class |
i |
a single index for |
lambda |
alternatively to specifying |
data |
the data originally used which must still be available. (The latter restriction will possibly be relaxed in the future.). By default it is found in the environment. |
fitfun |
fitting function that determines the structure of the
return value. Note that coefficients and more will be taken from
|
... |
additional arguments passed to |
extract.lassogrp
generates an object of a regression class
like lm
or regr
. This is useful for applying the
respective plot and print methods to the lasso fit.
The result of an unpenalized fit to the “selected” model
(terms with non-zero coefficients) is available as 'fit.unpen'
component of the result.
extract.lassogrp
: object of class lassofit
inheriting from
the class specified by fitfun
.
$fit.unpen
: The result of fitting the model (by codefitfun)
to the reduced model.
x[i]
: an object of class lassogrp
containing only the specified
fits, i.e. all the information corresponding to these fits.
Werner Stahel, stahel@stat.math.ethz.ch
data(asphalt) rr <- lasso(log10(RUT) ~ log10(VISC) + ASPH+BASE+FINES+VOIDS+RUN, data=asphalt, adaptive=TRUE) ## Extract results for three lambda's: rr[c(1,19,20)] extract.lassogrp(rr, 19) ## The above relies on finding the original data; ## it does not work otherwise d.a <- asphalt rm(asphalt) try(extract.lassogrp(rr, lambda=2.5)) # -> error: cannot find 'asphalt' ## it works if you can specify the data : extract.lassogrp(rr, lambda=2.5, data=d.a)