Claudia D'Aniello
2008-May-15 15:10 UTC
[R] How to remove autocorrelation from a time series?
Dear R users, someone knows how to remove auto-correlation from a frequencies time series? I've tried by differencing (lag 1) the cumulative series (in order to have only positive numbers) , but I can't remove all auto-correlation. If it's useful I can send my db. x <- # autocorrelated series new1<-cumsum(x) new2<-diff(new1,lag=1,differences = 1) acf(new2) # remains autocorrelated Thanks in advance Ciao Claudia ___________________________________ Scopri i http://www.ymailblogit.com/blog/
Claudia D'Aniello <kikki_80 <at> yahoo.it> writes:> > Dear R users, > someone knows how to remove auto-correlation from a frequencies time series? > I've tried by differencing (lag 1) the cumulative series (in order to haveonly positive numbers) , but I> can't remove all auto-correlation.Take the residuals from an ARIMA fit? (see arima(), residuals() ) -- this won't be automatic, you'll have to figure out the appropriate order model to fit ... good luck Ben Bolker
Claudia D'Aniello <kikki_80 <at> yahoo.it> writes:> > Dear R users, > someone knows how to remove auto-correlation from a frequencies time series? > I've tried by differencing (lag 1) the cumulative series (in order to haveonly positive numbers) , but I> can't remove all auto-correlation. > If it's useful I can send my db. > > x <- # autocorrelated series > new1<-cumsum(x) > new2<-diff(new1,lag=1,differences = 1) > acf(new2) # remains autocorrelated >This might come close to what your want ar = arima(lh, order = c(1,0,0)) plot(ar$residuals) Dieter