Learn R Programming

l2boost (version 1.0.3)

coef.l2boost: Extract model coefficients from an l2boost model object at any point along the solution path indexed by step m. coef is a generic function which extracts model coefficients from objects returned by modeling functions.

Description

By default, coef.l2boost returns the model (beta) coefficients from the last step, M of the l2boost model. For a cv.l2boost object, the default returns the coefficients from model at the cross-validation optimal step (m = opt.step return value).

Coefficients from alternative steps along the solution can be obtained using the m parameter.

Usage

# S3 method for l2boost
coef(object, m = NULL, ...)

Arguments

object

an l2boost fit object (l2boost or cv.l2boost)

m

the iteration number within the l2boost solution path. If m=NULL, the coefficients are obtained from the last iteration M.

...

other arguments passed to generic function.

Value

vector of coefficient estimates for l2boost objects. The estimates correspond to the given iteration number m, or the final step M.

See Also

coef and l2boost, cv.l2boost and predict.l2boost methods of l2boost.

Examples

Run this code
# NOT RUN {
#--------------------------------------------------------------------------
# Example: Diabetes data 
#  
# See Efron B., Hastie T., Johnstone I., and Tibshirani R. 
# Least angle regression. Ann. Statist., 32:407-499, 2004.
data(diabetes, package='l2boost')

object <- l2boost(diabetes$x,diabetes$y, M=1000, nu=.01)
coef(object)

# At the m=500 step
coef(object, m=500)

# }

Run the code above in your browser using DataLab