Learn R Programming

ts.extend (version 0.1.1)

rGARMA: Generate random vectors from the stationary GARMA distribution

Description

This function generates random vectors from the stationary Gaussian auto-regressive moving-average (GARMA) distribution. The user specifies the number of vectors n and their dimension m and the function returns an n x m matrix of generated time-series from the GARMA distribution with the specified parameters. By default the function generates from the marginal GARMA distribution, but the user may give conditional values in the condvals vector to generate from the associated conditional distribution (non-conditional values in this vector are given as NA).

Usage

rGARMA(
  n,
  m,
  condvals = as.numeric(NA),
  mean = 0,
  errorvar = 1,
  ar = numeric(0),
  ma = numeric(0)
)

Arguments

n

Positive integer giving the number of random vectors to generate

m

Positive integer giving the dimension of the random vectors to generate (i.e., the number of values in each time-series)

condvals

Either a single value NA or a numeric vector with m elements; numeric entries are conditioning values for the generated vector

mean

The mean parameter

errorvar

The error variance parameter

ar

Vector of auto-regressive coefficients (all roots of AR characteristic polynomial must be outside the unit circle)

ma

Vector of moving-average coefficients

Examples

Run this code
# NOT RUN {
#Set the model parameters
AR <- c(0.8, -0.2)
MA <- c(0.6,  0.3)
#Generate random time-series from the GARMA distribution
SERIES <- rGARMA(n = 16, m = 30, ar = AR, ma = MA)

#Set the conditional values
CONDVALS     <- rep(NA, 30)
CONDVALS[1]  <- -4
CONDVALS[12] <-  0
CONDVALS[30] <-  4

#Generate and plot random time-series from the GARMA distribution
SERIES.COND <- rGARMA(n = 16, m = 30, ar = AR, ma = MA, condvals = CONDVALS)
# }

Run the code above in your browser using DataLab