SimulateARMA {PRTest} | R Documentation |
SimulateARMA(n, phi, theta, InnovationVariance = 1, StableParameters = NULL, UseC = T, Q = 128)
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 |
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.
a time series of length n is generated
requires rstable
from the fBasics
package for
simulating the Stable innovation sequence.
A.I. McLeod
#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