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 " |
newx |
matrix of new values of design matrix at which predictions are to be made. Ignored
when |
s |
value of the penalty parameter at which predictions are required. If the value
is not one of the |
iter |
iteration at which predictions are required. Default is the entire sequence
of iterations in |
type |
of prediction required. Type " |
... |
not used. Other arguments to |
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, ])