[R] ACF normalization and Nesed For loops

alok juneja junejaalok at yahoo.com
Tue Dec 22 15:06:25 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 

nlme:::ACF.gls
nlme:::ACF.lme

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 

acf(distance,lag.max=l0,plot=FALSE)

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.

Best
Alok & Baloo

--- On Tue, 12/22/09, ONKELINX, Thierry <Thierry.ONKELINX at inbo.be> wrote:

> From: ONKELINX, Thierry <Thierry.ONKELINX at inbo.be>
> Subject: RE: [R] ACF normalization.
> To: "alok juneja" <junejaalok at yahoo.com>, "Prof Brian Ripley" <ripley at stats.ox.ac.uk>
> Cc: "R help" <r-help at r-project.org>
> Date: Tuesday, December 22, 2009, 3:12 PM
> Just enter nlme:::ACF.gls at the
> command prompt and hit enter. This works with most
> functions. Another option is to download the source code of
> nlme from CRAN.
> 
> HTH,
> 
> Thierry
> 
> 
> ----------------------------------------------------------------------------
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek
> team Biometrie & Kwaliteitszorg
> Gaverstraat 4
> 9500 Geraardsbergen
> Belgium
> 
> Research Institute for Nature and Forest
> team Biometrics & Quality Assurance
> Gaverstraat 4
> 9500 Geraardsbergen
> Belgium
> 
> tel. + 32 54/436 185
> Thierry.Onkelinx at inbo.be
> www.inbo.be
> 
> To call in the statistician after the experiment is done
> may be no more than asking him to perform a post-mortem
> examination: he may be able to say what the experiment died
> of.
> ~ Sir Ronald Aylmer Fisher
> 
> The plural of anecdote is not data.
> ~ Roger Brinner
> 
> The combination of some data and an aching desire for an
> answer does not ensure that a reasonable answer can be
> extracted from a given body of data.
> ~ John Tukey
>  
> -----Oorspronkelijk bericht-----
> Van: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org]
> Namens alok juneja
> Verzonden: dinsdag 22 december 2009 13:26
> Aan: Prof Brian Ripley
> CC: R help
> Onderwerp: Re: [R] ACF normalization.
> 
> May be please inform where I can find the source code for
> "nlme:::ACF.gls"
> and "nlme:::ACF.lme". Sorry to ask. As I have looked into
> the R directory but don't find that.
> 
> Best
> Alok
>  
> --- On Tue, 12/22/09, Prof Brian Ripley <ripley at stats.ox.ac.uk>
> wrote:
> 
> > From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
> > Subject: Re: [R] ACF normalization.
> > To: "alok juneja" <junejaalok at yahoo.com>
> > Cc: "R help" <r-help at r-project.org>
> > Date: Tuesday, December 22, 2009, 11:58 AM On Tue, 22
> Dec 2009, alok 
> > juneja
> > wrote:
> > 
> > > Hi,
> > >
> > > My earlier email was sent as html so no visible
> > properly. I am now posting it as text. Sorry for the
> duplication of 
> > the message.
> > >
> > >
> > > Can anyone please provide the formula used to
> compute
> > ACF(nlme). I believe the one that is used in R is of
> the type 
> > mentioned on the website (http://www.itl.nist.gov/div898/handbook/eda/section3/autocopl.htm).
> > Please correct me if I am wrong. The normalization of
> the numerator 
> > (Ch)
> > > has been done by 'N' where as I would like to do
> it by
> > 'N-k'. Is there
> > > anyway in the present implementation of ACF to
> > normalize it by 'N-k',
> > > where 'N' is the total number of observations and
> 'k'
> > is the lag.
> > 
> > Please read the code for yourself:
> > 
> > nlme:::ACF.gls
> > nlme:::ACF.lme
> > 
> > whichever is appropriate.
> > 
> > > Best
> > > Alok
> > >
> > > ______________________________________________
> > > R-help at 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.
> > >
> > 
> > --
> > Brian D. Ripley,
> >       ripley at stats.ox.ac.uk
> > Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> > University of Oxford,
> >    Tel:  +44 1865 272861 (self)
> > 1 South Parks Road,
> >            +44 1865
> > 272866 (PA)
> > Oxford OX1 3TG, UK
> >     Fax:  +44 1865 272595
> > 
> 
> 
> 
> 
> ______________________________________________
> R-help at 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.
> 
> Druk dit bericht a.u.b. niet onnodig af.
> Please do not print this message unnecessarily.
> 
> Dit bericht en eventuele bijlagen geven enkel de visie van
> de schrijver weer 
> en binden het INBO onder geen enkel beding, zolang dit
> bericht niet bevestigd is
> door een geldig ondertekend document. The views expressed
> in  this message 
> and any annex are purely those of the writer and may not be
> regarded as stating 
> an official position of INBO, as long as the message is not
> confirmed by a duly 
> signed document.
> 







More information about the R-help mailing list