SimMA {PRTest}R Documentation

Compute MA using convolve

Description

Uses the R function convolve to compute the moving-average Provides efficient algorithm for simulating a moving-average process given the innovations.

Usage

SimMA(psi, a)

Arguments

psi vector of MA coefficients starting with 1.
a innovations

Details

z_t = sum_{k=0}^Q psi_k a_{t-k}

where t=1,...,n and the innovations $a_t, t=1-Q, ..., 0, 1, ..., n$ are given in the input vector a.

Since convolve uses the FFT this is faster than direct computation.

Value

vector of length n, where n=length(a)-length(psi)

Author(s)

A.I. McLeod

See Also

convolve, SimulateARMA, arima.sim

Examples

#Simulate an AR(1) process with parameter phi=0.8 of length n=100 with
#  innovations from a t-distribution with 5 df and plot it.
#
psi<-phi^(0:127)
n<-100
Q<-length(psi)-1
a<-rt(n+Q,5)
z<-SimMA(psi,a)
z<-ts(z)
plot(z)

[Package PRTest version 1.0 Index]