predict.kqr {fastkqr}R Documentation

Predict the fitted values for a kqr object.

Description

Predict the fitted values for a kqr object.

Usage

## S3 method for class 'kqr'
predict(object, x, newx = NULL, s = NULL, ...)

Arguments

object

A fitted kqr object.

x

The predictor matrix, i.e., the x matrix used when fitting the kqr object.

newx

A matrix of new values for x at which predictions are to be made. Note that newx must be of a matrix form, predict function does not accept a vector or other formats of newx.

s

Value(s) of the penalty parameter 'lambda' at which predictions are required. Default is the entire sequence used to create the model.

...

Not used.

Details

The result is \beta_0 + K_i' \alpha where \beta_0 and \alpha are from the kqr object and K_i is the ith row of the kernel matrix.

Value

Returns the fitted values.

Examples

library(MASS)
data(GAGurine)
x <- as.matrix(GAGurine$Age)
y <- GAGurine$GAG
lambda <- 10^(seq(1, -4, length.out=30))
fit <- kqr(x, y, lambda=lambda, tau=0.1, is_exact=TRUE)
predict(fit, x, tail(x))

[Package fastkqr version 1.0.0 Index]