Predicted values based on slm
object.
# S3 method for slm
predict(object, newdata = NULL, interval = "confidence",
level = 0.95, ...)
an object of class slm
.
an optional data frame in which to look for variables with which to predict.
newdata
must contain only variables and not the intercept.
If omitted, the fitted values are used.
type of interval calculation. It can be only interval = "confidence"
, the default value. It computes
the confidence intervals for
a number between 0 and 1, which indicates the tolerance/confidence level.
further arguments passed to or from other methods.
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.
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.
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab