[R] filtering ts with arima

Spencer Graves spencer.graves at pdf.com
Wed Apr 9 17:00:06 CEST 2003


Did you try library(ts)?

Spencer Graves

Samak, Vele [EQRE] wrote:
> Anyone know how to do this? Thanks,
> 
> -----Original Message-----
> From: Samak, Vele [EQRE] 
> Sent: Monday, April 07, 2003 11:30 AM
> To: 'r-help at stat.math.ethz.ch'
> Subject: [R] filtering ts with arima
> 
> 
> Hi,
> 
> I have the following code from Splus that I'd like to migrate to R. So far,
> the only problem is the arima.filt function. This function allows me to
> filter an existing time-series through a previously estimated arima model,
> and obtain the residuals for further use. Here's the Splus code:
> 
> # x is the estimation time series, new.infl is a timeseries that contains
> new information
> # a.mle is estimated result (list) from arima.mle, (1,0,1) x (1,0,1)12
> seasonal model
> mdl 	_ list(list(order=c(1,0,1)), list(order=c(1,0,1), period=12))
> a.mle	_ arima.mle(x, model = mdl)
> 
> # then, we get regular residuals:
> new.pred        _ arima.filt(new.infl, a.mle$model)$pred  
> new.res         _ new.infl - new.pred 
> 
> The R code from library(ts) would be:
> 
> # new.infl is a timeseries
> # a.mle is estimated result (list) from arima.mle, (1,0,1) x (1,0,1)12
> seasonal model
> a2.mle _ arima(x, order=c(1,0,1), seasonal=list(order=c(1,0,1), period=12),
> include.mean=F, method="ML")
> 
> new.infl ????
> new.res         _ new.infl - new.pred 
> 
> What's the arima.filt equivalent in R: filter doesn't seem to take the
> coefficients for a seasonal model correctly, also predict isn't quite the
> answer? Help is appreciated. Thanks,
> 
> 
> 
>>Vele Samak
>>Vice President
>>Global Quantitative Research Group
>>CITIGROUP / Smith Barney
>>388 Greenwich St. 29th Floor
>>New York, NY 10013
>>(212) 816-0379
> 
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help



More information about the R-help mailing list