predict.kspm: Predicting Kernel Semi parametric Model Fits

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/predictKspm.R

Description

predict method for class "kspm".

Usage

1
2
3
## S3 method for class 'kspm'
predict(object, newdata.linear = NULL,
  newdata.kernel = NULL, interval = "none", level = 0.95, ...)

Arguments

object

an object of class "kspm", usually, a result of a call to kspm.

newdata.linear

should be a data frame or design matrix of variables used in the linear part

newdata.kernel

a list containing data frame or design matrix of variables used in each kernel part depending on the specification format of each kernel. When a kernel has been specified using kernel.function = "gram.matrix" in Kernel function, the user should also provide the Gram matrix associated to the new data points in newdata.kernel. The function info.kspm may help to correctly specify it.

interval

type of interval calculation. If "none" (default), no interval is computed, if "confidence", the confidence interval is computed, if "prediction", the prediction interval is computed.

level

confidence level. Default is level = 0.95 meaning 95% confidence/prediction interval.

...

further arguments passed to or from other methods.

Details

predict.kspm produces predicted values. If a new dataset is not specified, it will return the fitted values from the original data (complete data used in the model specification). If predict.kspm is applied to a new dataset, all variables used in the original model should be provided in newdata.linear and newdata.kernel arguments but only complete data may be provided. Setting interval specifies computation of confidence or prediction intervals at the specified level.

Value

predict.kspm returns a vector of predictions or a matrix containing the following components if interval is set:

fit

predictions.

lwr

lower bound of confidence/prediction intervals.

upr

upper bound of confidence/prediction intervals.

Author(s)

Catherine Schramm, Aurelie Labbe, Celia Greenwood

See Also

kspm, summary.kspm.

Examples

1
2
3
4
5
6
7
x <- 1:15
z1 <- runif(15, 1, 6)
z2 <- rnorm(15, 1, 2)
y <- 3*x + (z1 + z2)^2 + rnorm(15, 0, 2)
fit <- kspm(y, linear = ~ x, kernel = ~ Kernel(~ z1 + z2,
kernel.function = "polynomial", d= 2, rho = 1, gamma = 0))
predict(fit, interval = "confidence")

KSPM documentation built on Aug. 10, 2020, 5:07 p.m.