[R] Query: how to modify the plot of acf
Andrew Robinson
A.Robinson at ms.unimelb.edu.au
Sun Aug 20 10:17:34 CEST 2006
Try constructing the acf plot using the traditional plot tools. Then
you can do what you like with it. Eg if your model is called
model.lme, then something like this should work:
acf.resid <- ACF(model.lme, resType = "n")
my.lags <- acf.resid$lag > 0.5
plot(acf.resid$lag[my.lags], acf.resid$ACF[my.lags],
type="b", main="Residual Autocorrelation",
xlab="Lag", ylab="Correlation", axes=F)
stdv <- qnorm(1 - 0.01/2)/sqrt(attr(acf.resid, "n.used"))
lines(acf.resid$lag[my.lags], stdv[my.lags], col="darkgray")
lines(acf.resid$lag[my.lags], -stdv[my.lags], col="darkgray")
abline(0,0,col="gray")
box()
axis(1)
axis(2)
Modify the first axis to put ticks and numbers where you want them.
Double-check the image against the plot of the ACF object to be sure
that it lines up right.
Cheers
Andrew
On Fri, Aug 18, 2006 at 04:50:01PM +0200, Stefano Sofia 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.
--
Andrew Robinson
Department of Mathematics and Statistics Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: a.robinson at ms.unimelb.edu.au http://www.ms.unimelb.edu.au
More information about the R-help
mailing list