predict.slm {slm} | R Documentation |
Predict for slm object
Description
Predicted values based on slm
object.
Usage
## S3 method for class 'slm'
predict(object, newdata = NULL, interval = "confidence",
level = 0.95, ...)
Arguments
object |
an object of class |
newdata |
an optional data frame in which to look for variables with which to predict.
|
interval |
type of interval calculation. It can be only |
level |
a number between 0 and 1, which indicates the tolerance/confidence level. |
... |
further arguments passed to or from other methods. |
Details
This function produces predicted values, obtained by evaluating the regression function in the frame newdata
(which defaults to model.frame(object)
). If newdata
is omitted the predictions are based on the data used for the fit.
Value
This function produces a vector of predictions or a matrix of predictions and bounds with column names fit
, lwr
,
and upr
if interval
is set.
See Also
Examples
data("shan")
reg1 = slm(shan$PM_Xuhui ~ . , data = shan, method_cov_st = "fitAR", model_selec = -1)
predict(reg1)
data("co2")
y = as.vector(co2)
x = as.vector(time(co2)) - 1958
reg2 = slm(y ~ x + I(x^2) + I(x^3) + sin(2*pi*x) + cos(2*pi*x) + sin(4*pi*x) +
cos(4*pi*x) + sin(6*pi*x) + cos(6*pi*x) + sin(8*pi*x) + cos(8*pi*x),
method_cov_st = "fitAR", model_selec = -1)
predict(reg2)