Hi! I want to plot three graphs (residuals, ACF and PACF of a model). Ideally I would use a c(2,2) disposition where the residuals plot would start at position 1,1 and span to position 1,2. Then I would plot the ACF in position 2,1 and the PACF in position 2,2. Maybe is clearer like this: -------------------------- | | | residuals | | | -------------------------- ------------ ------------- | | | | | ACF | | PACF | | | | | ------------ ------------- Does anyone know if that is possible at all? Cheers! -- -- -- Jose Luis Aznarte M. http://decsai.ugr.es/~jlaznarte Department of Computer Science and Artificial Intelligence Universidad de Granada Tel. +34 - 958 - 24 04 67 GRANADA (Spain) Fax: +34 - 958 - 24 00 79
Try this: l <- layout(matrix(c(1, 2, 1, 3), 2)) layout.show(l) On Thu, Aug 28, 2008 at 9:40 AM, Jose Luis Aznarte M. < jlaznarte@decsai.ugr.es> wrote:> Hi! I want to plot three graphs (residuals, ACF and PACF of a model). > Ideally I would use a c(2,2) disposition where the residuals plot would > start at position 1,1 and span to position 1,2. Then I would plot the ACF in > position 2,1 and the PACF in position 2,2. Maybe is clearer like this: > > -------------------------- > | | > | residuals | > | | > -------------------------- > ------------ ------------- > | | | | > | ACF | | PACF | > | | | | > ------------ ------------- > > Does anyone know if that is possible at all? Cheers! > > -- > -- -- > Jose Luis Aznarte M. http://decsai.ugr.es/~jlaznarte<http://decsai.ugr.es/%7Ejlaznarte> > Department of Computer Science and Artificial Intelligence > Universidad de Granada Tel. +34 - 958 - 24 04 67 > GRANADA (Spain) Fax: +34 - 958 - 24 00 79 > > ______________________________________________ > R-help@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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
library(HH) example(tsacfplots) ?tsacfplots
On Thu, 28 Aug 2008, Jose Luis Aznarte M. wrote:> Hi! I want to plot three graphs (residuals, ACF and PACF of a model). > Ideally I would use a c(2,2) disposition where the residuals plot would start > at position 1,1 and span to position 1,2. Then I would plot the ACF in > position 2,1 and the PACF in position 2,2. Maybe is clearer like this: > > -------------------------- > | | > | residuals | > | | > -------------------------- > ------------ ------------- > | | | | > | ACF | | PACF | > | | | | > ------------ ------------- > > Does anyone know if that is possible at all? Cheers! >I happened to do virtually that plot just recently. Just had data rather than residuals: ### Function to display plot, ACF and PACF displayTimeSeries <- function(x, heading = NULL, heights = NULL, ...){ defaultPars <- par(no.readonly = TRUE) if (is.null(heading)) { heading <- paste("Series: ", deparse(substitute(x))) } if (is.null(heights)) heights <- c(1,1) layout(matrix(c(1,1,2,3), 2, 2, byrow = TRUE), heights = heights) plot(x, main = heading) par(mar = c(5,4,1,2) + 0.1) acfVal <- acf(x, main = "")$acf pacfVal <- acf(x, type = "partial", main = "")$acf par(defaultPars) invisible(list(acf = acfVal, pacf = pacfVal)) } If you add a line which calculates the residuals and plots them instead of the data, then you should have what you want. David Scott _________________________________________________________________ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: d.scott at auckland.ac.nz Graduate Officer, Department of Statistics Director of Consulting, Department of Statistics