I've been looking for an IACF() procedure in R for a long time (it's a very convenient function to check for overdifferencing time series), and eventually decided to write my own function. Here's what I came up with :
3 web-pages helped me estimate it : http://www.xycoon.com/inverse_autocorrelations.htm http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_arima_sect026.htm --> How SAS does it www.jos.nu/Articles/abstract.asp?article=42113 page 116 --> choice of order.max "p" : not too large so that the estimators' std.errors remain reasonably small, but large enough so that for high lags, the inverse autocorrelationq approach zero. One can try 10,20,30,40... it's not recommended to go over N/4 given a "ts" object ts.1 : artest <- ar(ts.1,aic=F,order.max=30,method="yule-walker") #choice p=30 acfth <- ARMAacf(ar=numeric(0),ma=artest$ar) #compute theoretical acf for an MA, taking the estimated AR coefficients # Then we plot, using ggplot2 : library(ggplot2) base <- data.frame(IACF=as.vector(acfth),Lag=as.numeric(names(acfth))) ci <- 0.95 climy <- qnorm((1 + ci)/2) / sqrt(artest$n.used) ###Computing significativity levels q2 <- qplot(Lag, IACF, data = base, yend = 0, xend = Lag, geom="bar",stat="identity",fill=I("Darkblue"))+theme_bw()+geom_hline(yintercept=c(-climy,climy),colour="red",linetype="dashed")+opts(title=expression(paste("Inverse autocorrelogram of ",y[t])),plot.title = theme_text(size = 25))+geom_hline(yintercept=0) q2 Hope this can help somebody JB Lepetit -- View this message in context: http://r.789695.n4.nabble.com/Inverse-autocorrelation-fonction-tp3527467p3527467.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.