forecast.masal: Predict method for MASAL Model Fits

Description Usage Arguments Details Value See Also Examples

View source: R/forecast.R

Description

Predicted values based on MASAL model object.

Usage

1
2
  ## S3 method for class '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

Details

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

Value

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

See Also

The model fitting function masal.

Examples

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

macs documentation built on Oct. 9, 2019, 5:05 p.m.

Related to forecast.masal in macs...