[R] ACF normalization and Nesed For loops

alok juneja junejaalok at yahoo.com
Wed Dec 23 07:13:16 CET 2009

Thanks for the suggestions..

I must admit that on the R-help one of my coworker is asking the same question named "Nested For loops". My question "ACF normalization" and his question both lead to the same problem. So now I merge both the questions. Sorry for the inconvenience.

The main problem is ...

Since the ACF(nlme) is doing the the normalization of the numerator (Ch)
by 'N' where as we would like to do it by 'N-k'. In order to deal with that we wrote the code to normalize it by 'N-k' using for loop. Since the for loop is not so efficient as our data set is so big that it is going take lots of lots days which we can not afford. That is why we were thinking of optimizing our approach without using nested for loops..

As per the suggestions by Prof. Ripley, Paul and Thierry, the best approach I figured out is to modify the ACF(nlme). Prof. Ripley adviced to look for the code


I would like to make changes in ACF(nlme). I am using neither ACF.gls nor ACF.lme. I am using the eneric ACF(). The question comes here that I need to modify the implemented version of generic ACF of R but which one. As when I used ACF, I simply used it like


but I am not sure by default generic ACF is using either ACF.gls or ACF.lme
Please guide so that I can kick start.


More information about the R-help mailing list