Learn R Programming

macs (version 1.0)

forecast.masal: Predict method for MASAL Model Fits

Description

Predicted values based on MASAL model object.

Usage

# S3 method for masal
forecast(object, newdata = NULL, col = NULL, ...)

Arguments

object

Object of class inheriting from "masal"

newdata

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

col

A character vector indicating each column in the data : c(covariate), t(time), s(sort). If omitted, the fitted values are used.

...

Further arguments to be passed to forecast.masal

Value

forecast.masal produces a vector of predictions for all rows.

Details

forecast.masal produces predicted values, obtained by evaluating the regression function in the frame newdata.

See Also

The model fitting function masal.

Examples

Run this code
# NOT RUN {
library("macs")
set.seed(123)
data <- data.frame(ID = sort(rep(1:100, 5)),
                    X1 = runif(500, min = 0, max = 1),
                    X2 = runif(500, min = 0, max = 2),
                    X3 = runif(500, min = 0, max = 4),
                    X4 = rnorm(500, mean = 0, sd = 1),
                    X5 = rnorm(500, mean = 0, sd = 2),
                    X6 = rnorm(500, mean = 0, sd = 3),
                    time = rep(1:5, 100),
                    Y = rnorm(500, mean = 40, sd = 10))
result <- masal(data, col = NULL, maxterm = 20, maxinteraction = 2,
 varhat = c(1, 1, 1), forced_num = NULL, maxiter = 2)
forecast(result)
# }

Run the code above in your browser using DataLab