predict.kspm {KSPM} | R Documentation |
Predicting Kernel Semi parametric Model Fits
Description
predict method for class "kspm".
Usage
## 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 |
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 |
interval |
type of interval calculation. If |
level |
confidence level. Default is |
... |
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
Examples
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")