Skip to content
Prev 154450 / 398500 Next

Plots spanning columns

On Thu, 28 Aug 2008, Jose Luis Aznarte M. wrote:

            
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