[R] Query: how to modify the plot of acf

Gabor Grothendieck ggrothendieck at gmail.com
Sat Aug 19 21:00:14 CEST 2006


Try this.  It uses Matthias' trick for getting rid of lag 1.
The it defines a new local plot.acf
 and then
defines a new local plot.acf which


# test data
set.seed(1)
x <- rnorm(1000)

# run acf
x.acf <- acf(x)

# remove lag 0 -- see Matthias' post
x.acf$acf[1] <- NA

# plot with custom x axis
plot(x.acf, xaxt = "n")
axis(1, seq(12, length(x.acf$acf), 12))





On 8/18/06, Stefano Sofia <stefano.sofia at regione.marche.it> wrote:
> I need to modify the graph of the autocorrelation. I tried to do it through plot.acf but with no success.
>
> 1. I would like to get rid of the lag zero
> 2. I would like to have numbers on the x-axis only at lags 12, 24, 36, 48, 60, ...
>
> Could anybody help me in this?
>
> Any help will be appreciated
> Thank you for your attention
> Stefano
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list