Description Usage Arguments Details Value Author(s) Examples
Extract a regression fit from a lasso fit (table) of class
"linkS4class{lassogrp}".
1 2 3 4 |
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 (S3) class "lassofit",
also inheriting from the class specified by fitfun.
Component fit.unpen: The result of fitting the model (by fitfun)
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | data(asphalt)
rr <- lasso(log10(RUT) ~ log10(VISC) + ASPH+BASE+FINES+VOIDS+RUN,
data=asphalt, adaptive=TRUE)
length(rr$lambda) # 21
## Extract results for three lambda's (currently works wrongly!)
rr[c(1,19,20)]
extract.lassogrp(rr, 2)
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.