[R] Query: how to modify the plot of acf
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
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")
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.
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
> [[alternative HTML version deleted]]
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
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