predict.l2boost: predict method for l2boost models.

Description Usage Arguments Value See Also Examples

Description

predict is a generic function for predictions from the results of various model fitting functions.

@details predict.l2boost takes the optional xnew (equivalent newdata) data.frame and returns the model estimates from an l2boost object. If neither xnew or newdata are provided, predict returns estimates for the l2boost training data set.

By default, predict.l2boost returns the function estimates, unless type="coef" then the set of regression coefficients (beta) are returned from the l2boost object.

Usage

1
2
3
## S3 method for class 'l2boost'
predict(object, xnew = NULL, type = c("fit", "coef"),
  newdata = xnew, ...)

Arguments

object

an l2boost object

xnew

a new design matrix to fit with the l2boost object

type

"fit" or "coef" determins the values returned. "fit" returns model estimates, "coef" returns the model coefficients

newdata

a new design matrix to fit with the l2boost object

...

other arguments (currently not used)

Value

function estimates for type=fit, coefficient estimates for type=coef

or

See Also

predict and l2boost, coef.l2boost, fitted.l2boost, residuals.l2boost and cv.l2boost

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#--------------------------------------------------------------------------
# Example 1: Diabetes 
#  
# See Efron B., Hastie T., Johnstone I., and Tibshirani R. 
# Least angle regression. Ann. Statist., 32:407-499, 2004.
data(diabetes)

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

# With no arguments returns the estimates at the full M from the training data.
prd <- predict(object)
prd$yhat

# at step m=600
prd$yhat.path[[600]]

# Also can return coefficient estimates. This is equivalent to \code{\link{coef.l2boost}}
cf <- predict(object, type="coef")
cf$coef

# at step m=600
cf$coef.path[[600]]

# Or used to predict new data, in this case a subset of training data
cbind(diabetes$y[1:5], predict(object, xnew=diabetes$x[1:5,])$yhat)

ehrlinger/l2boost documentation built on May 16, 2019, 1:20 a.m.