predict.slm: Predict for slm object

Description Usage Arguments Details Value See Also Examples

View source: R/slm-method.R

Description

Predicted values based on slm object.

Usage

1
2
3
## S3 method for class '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 x' beta, 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.

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

predict.lm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

slm documentation built on Aug. 31, 2020, 5:11 p.m.