Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

slm (version 1.2.0)

predict.slm: Predict for slm object

Description

Predicted values based on slm object.

Usage

# S3 method for slm
predict(object, newdata = NULL, interval = "confidence",
  level = 0.95, ...)

Arguments

object

an object of class slm.

newdata

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.

interval

type of interval calculation. It can be only interval = "confidence", the default value. It computes the confidence intervals for xbeta, where x is a new observation of the design.

level

a number between 0 and 1, which indicates the tolerance/confidence level.

...

further arguments passed to or from other methods.

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.

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.

See Also

predict.lm.

Examples

Run this code
# 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