[R] Transfer Function Modeling

Richard A. Bilonick rab at nauticom.net
Wed Mar 5 18:01:01 CET 2003

I think I've figured out the use of "filter" in the ts package, at least 
for a simple AR model. I simulated a simple AR time series, modeled it 
using "arima",  and then used "filter" to compute the 1-step ahead 

 > y.arma <- arima.sim(list(ar=0.8),n=200)
 > y.arma.arima <- arima(y.arma,order=c(1,0,0),include.mean=FALSE)
 > y.arma.arima

arima(x = y.arma, order = c(1, 0, 0), include.mean = FALSE)

s.e.  0.0455

sigma^2 estimated as 1.059:  log likelihood = -290,  aic = 583.99

 > plot(y.arma[-1],lines="l")
 > lines(filter(y.arma,y.arma.arima$coef,method="con")[-200],lty=2)

So using the "convolution" method appears to produce the correct 
forecast for the y.arma series.

But suppose I had generated and fitted an ARMA(1,1) or ARIMA(1,1,1) 
model? How would I use "filter" in this case?

Rick B.

More information about the R-help mailing list