predict.BT {LassoBacktracking}R Documentation

Make predictions from a "BT" object.

Description

Similar to other predict methods, this function predicts fitted values and computes coefficients from a fitted "BT" object.

Usage

## S3 method for class 'BT'
predict(
  object,
  newx,
  s = NULL,
  iter = NULL,
  type = c("response", "coefficients"),
  ...
)

## S3 method for class 'BT'
coef(object, s = NULL, iter = NULL, ...)

Arguments

object

fitted "BT" object.

newx

matrix of new values of design matrix at which predictions are to be made. Ignored when type=="coefficients".

s

value of the penalty parameter at which predictions are required. If the value is not one of the lambda values present in object the output will be etermined by linear interpolation. Default is the entire sequence of lambda values present in object.

iter

iteration at which predictions are required. Default is the entire sequence of iterations in object.

type

of prediction required. Type "response" gives estimates of the response whilst type "coefficients" gives coefficient estimates.

...

not used. Other arguments to predict.

Value

Either a vector of predictions or, if either s or iter are NULL, a three-dimensional array with last two dimensions indexing different lambda values and iterations.

Examples

x <- matrix(rnorm(100*250), 100, 250)
y <- x[, 1] + x[, 2] - x[, 1]*x[, 2] + x[, 3] + rnorm(100)
out <- LassoBT(x, y, iter_max=10)
predict(out, newx=x[1:2, ])

[Package LassoBacktracking version 1.1 Index]