generate.mar {gratis}R Documentation

Generate a tsibble of synthetic data from a Mixture Autoregressive model

Description

This function simulates multiple random sample paths from a mixture of k Gaussian AR(p) processes. The model is of the form

y_t = \phi_{0,i} + \phi_{1,i}y_{t-1} + \dots + \phi_{p,i}y_{t-p} + \sigma_{i,t}\epsilon_t

with probability \alpha_i, where \epsilon_t is a N(0,1) variate. The index of the tsibble is guessed from the MAR model seasonal periods.

Usage

## S3 method for class 'mar'
generate(x, length = 100, nseries = 10, ...)

## S3 method for class 'ets'
generate(x, length = 100, nseries = 10, ...)

## S3 method for class 'Arima'
generate(x, length = 100, nseries = 10, ...)

Arguments

x

A 'mar' object, usually the output of mar_model().

length

length of series to generate

nseries

number of series to generate

...

Other arguments, passed to simulate.mar.

Value

'tsibble' object with 'length' rows and 3 columns.

Author(s)

Rob J Hyndman

References

Feng Li, Mattias Villani, and Robert Kohn. (2010). Flexible Modeling of Conditional Distributions using Smooth Mixtures of Asymmetric Student T Densities, Journal of Statistical Planning and Inference, 140(12), pp. 3638-3654.

See Also

mar_model, simulate.mar

Examples

# MAR model with constant variances
phi <- cbind(c(0, 0.8, 0), c(0, 0.6, 0.3))
weights <- c(0.8, 0.2)
model1 <- mar_model(phi = phi, sigmas = c(1, 2), weights = weights)
generate(model1, nseries = 5)
# MAR model for hourly data with daily and weekly periods
hourly_model <- mar_model(seasonal_periods = c(24, 24*7))
generate(hourly_model)

[Package gratis version 1.0.7 Index]