SimulateARMA {PRTest}R Documentation

Simulate ARMA time series. Gaussian or Stable innovations.

Description

Usage

SimulateARMA(n, phi, theta, InnovationVariance = 1, StableParameters = NULL, UseC = T, Q = 128)

Arguments

n length of series
phi AR parameters
theta MA parameters
InnovationVariance If Gaussian, this is the innovation variance
StableParameters If Stable, this is the vector of 4 parameters described in FitStable
UseC If True, call compiled C code for extra speed
Q MA approximation used to compute initial values

Details

The ARMA(p,q) is approximated by a MA(Q) model by using the impulse response coefficients from lags 0 to lag Q-1 and then the r=max(p,q) initial time series values are computed. The remaining n-r values are computed directly from the model equation using the compiled C code when UseC=TRUE. Otherwise when UseC=FALSE, a for loop in R is used.

Value

a time series of length n is generated

Note

requires rstable from the fBasics package for simulating the Stable innovation sequence.

Author(s)

A.I. McLeod

See Also

SimMA, arima.sim

Examples

#obtain timing comparison for simulation methods
#
n<-1000  #length of series
NREP<-25 # number of replications
phi<-c(0.8,0.1)
theta<-c(-0.8, 0.1)
start<-proc.time()[1]
for (i in 1:NREP) 
    x<-SimulateARMA(n,phi,theta,c(1.7,0.1,1,0),UseC=T)
T1<-proc.time()[1]-start
start<-proc.time()[1]
for (i in 1:NREP) 
    x<-SimulateARMA(n,phi,theta,c(1.7,0.1,1,0),UseC=F)
T2<-proc.time()[1]-start    
Tot<-c(T1,T2,T2/T1)
names(Tot)<-c("With C","Without C","
Tot

[Package PRTest version 1.0 Index]