predict.prais: Predict Method for Objects of Class prais

View source: R/predict.prais.R

predict.praisR Documentation

Predict Method for Objects of Class prais

Description

Predicted values based on Prais-Winsten object.

Usage

## S3 method for class 'prais'
predict(object, newdata = NULL, ...)

Arguments

object

an object of class "prais", usually, a result of a call to prais_winsten.

newdata

an optional data frame in which to look for variables with which to predict. It must contain the variables that appear in formula, which do not have to be transformed beforehand. If omitted, the fitted values are used.

...

further arguments passed to or from other methods.

Details

The predictions are the conditional mean of the model, i.e. the product of the regressors and the coefficients. The AR(1) structure of the errors is not used, so the result does not contain the forecast of the serially correlated part of the error term.

Value

A vector of predictions.

References

Prais, S. J. and Winsten, C. B. (1954): Trend Estimators and Serial Correlation. Cowles Commission Discussion Paper, 383 (Chicago).

Examples

# Generate an artificial sample
set.seed(1234567)
n <- 100
x <- sample(20:40, n, replace = TRUE)
rho <- .5

# AR(1) errors
u <- rnorm(n, 0, 5)
for (i in 2:n) {
  u[i] <- u[i] + rho * u[i - 1]
}
pw_sample <- data.frame("x" = x, "y" = 10 + 1.5 * x + u, "time" = 1:n)

# Estimate
pw <- prais_winsten(y ~ x, data = pw_sample, index = "time")

# Predict
fcst <- predict(pw)


prais documentation built on Sept. 19, 2026, 1:06 a.m.