TSSS (version 1.3.4-5)

simssm: Simulation by Gaussian State Space Model

Description

Simulate time series by Gaussian State Space Model.

Usage

simssm(n = 200, trend = NULL, seasonal.order = 0, seasonal = NULL,
       arcoef = NULL,  ar = NULL, tau1 = NULL, tau2 = NULL, tau3 = NULL,
       sigma2 = 1.0, seed = NULL, plot = TRUE, ...)

Value

An object of class "simulate", giving simulated data of Gaussian state space model.

Arguments

n

the number of data generated by simulation.

trend

initial values of trend component of length \(m1\), where \(m1\) is trend order (1, 2). If NULL (default), trend order is 0.

seasonal.order

order of seasonal component model (0, 1, 2).

seasonal

if seasonal.order > 0, initial values of seasonal component of length \(p-1\), where \(p\) is period of one season.

arcoef

AR coefficients.

ar

initial values of AR component.

tau1

variance of trend component model.

tau2

variance of AR component model.

tau3

variance of seasonal component model.

sigma2

variance of the observation noise.

seed

arbitrary positive integer to generate a sequence of uniform random numbers. The default seed is based on the current time.

plot

logical. If TRUE (default), simulated data are plotted.

...

graphical arguments passed to plot.simulate.

References

Kitagawa, G. (2020) Introduction to Time Series Modeling with Applications in R. Chapman & Hall/CRC.

Examples

Run this code
# BLSALLFOOD data
data(BLSALLFOOD)
m1 <- 2; m2 <- 1; m3 <- 2
z <- season(BLSALLFOOD, trend.order = m1, seasonal.order = m2, ar.order = m3)

nl <- length(BLSALLFOOD)
trend <- z$trend[m1:1]
arcoef <- z$arcoef
period <- 12
seasonal <- z$seasonal[(period-1):1]
ar <- z$ar[m3:1]
tau1 <- z$tau2[1]
tau2 <- z$tau2[2]
tau3 <- z$tau2[3]
simssm(n = nl, trend, seasonal.order = m2, seasonal, arcoef, ar, tau1, tau2, tau3,
        sigma2 = z$sigma2, seed = 333)

Run the code above in your browser using DataLab