Learn R Programming

fastliu (version 1.0)

predict.liureg: Predict method for liureg objects

Description

Predict method for liureg objects

Usage

# S3 method for liureg
predict(object, newdata, ...)

Value

Depending on whether the lambda is a scalar or a vector, the predict.liureg function returns a vector or matrix of predictions, respectively.

Arguments

object

A liureg object.

newdata

A data frame of new values for X at which predictions are to be made. Can be a data.frame or a matrix.

...

Not used in this implementation.

Author

Murat Genç

See Also

liureg(), predict(), summary(), pressliu(), residuals()

Examples

Run this code
data("Hitters")
Hitters <- na.omit(Hitters)
X <- model.matrix(Salary ~ ., Hitters)[, -1]
y <- Hitters$Salary
lam <- seq(0, 1, 0.01)
liu.mod <- liureg(X, y, lam)
# Predictions based on original X matrix.
predict(liu.mod)
# Predictions based on newdata. newdata can be a matrix or a data.frame.
predict(liu.mod, newdata=X[1:5, ])

Run the code above in your browser using DataLab