[R] Newbie: Acf function
Martin Percossi
martin at martinpercossi.com
Thu Feb 8 16:39:58 CET 2007
Funny enough, but by accident I typed unclass(acf) (I had meant to
unclass the *data* obtained as a result of applying this function), and
I saw the source code! From there I managed to reproduce your steps
below... In any case, many thanks to all for your help.
Martin
rolf at math.unb.ca wrote:
>Martin Percossi wrote:
>
>
>
>>Hi, I would like to use acf.plot on a correlogram that is computed
>>externally. In other words, I would like to "fake out" the acf object.
>>Is this possible?-- any help would be appreciated.
>>
>>
>
> (a) Note that it's ``plot.acf'' NOT acf.plot.
>
> (b) This is R --- ***ANYTHING*** is possible.
>
> (c) Create an object, say ``y'' of class ``acf'',
> having components with the right names. You could
> build a dummy acf object by
>
> > dum <- acf(rnorm(100),plot=FALSE)
>
> and the examine ``dum'' to see what it should consist of.
>
> (d) Something like:
>
> y <- list(acf=array(ecc,dim=c(length(ecc),1,1)),
> type="correlation",
> n.used=n.ecc,lag=array(0:(length(ecc)-1),
> dim=c(length(ecc),1,1)),
> series="ecc",snames=NULL)
> class(y) <- "acf"
> plot(y)
>
> where ``ecc'' is a vector comprising your ``externally
> created correlogram'' and ``n.ecc'' is the length of the series
> from which ecc was created. Note that the first entry of ecc
> should be 1; it corresponds to lag 0.
>
> cheers,
>
> Rolf Turner
> rolf at math.unb.ca
>
>
More information about the R-help
mailing list