CORRELOGRAM Procedure

Standard Library procedure that plots a correlogram using either autocorrelation function (ACF) values or partial autocorrelation function (PACF) values.

Usage

    CORRELOGRAM, values, nelems

Input Parameters

values—A 1D array of autocorrelation function values.

nelems—A scalar integer defining the length of the series from which the autocorrelation values were computed.

Keywords

Confidence—A two-element vector containing the confidence bands to plot on the Y axis. By default, this band is plotted with dashed lines at and approximates the 95% confidence level.

Conf_Color—A scalar integer defining the color the confidence bands should be displayed in.

Highlight—A scalar integer defining the color to associate with significant lags.

NoMinor—If set and nonzero, X axis minor tick marks are suppressed.

Pacf—If set and nonzero, values input is assumed to be partial autocorrelation values.

The following additional keywords let you control many aspects of a plot’s appearance. Valid keywords for the CORRELOGRAM procedure are listed below. For a description of each keyword, see Graphics and Plotting Keywords.

Background

Position

[XY]Charsize

Charsize

Ptick_color

[XY]Range

Charthick

Ptl_color

[XY]Style

Clip

P[XY]a_color

[XY]Ticklen

Color

P[XY]t_color

[XY]Tickname

Font

Subtitle

[XY]Ticks

Gridstyle

Thick

[XY]Tickv

Noaxis

Ticklen

[XY]Title

Nodata

Title

[XY]Type

Noerase

 

 

Discussion

Correlograms are plots of autocorrelations or partial autocorrelations associated with time-series data. Correlograms showing partial autocorrelations are sometimes called partial correlograms. Correlograms show the relationship between autocorrelation coefficients against increasing time lags and are useful for visualizing the correlation structure in time-series data. For example, in the Box-Jenkins approach to time-series model building, correlograms of autocorrelations and partial autocorrelations are viewed together to assess whether the series in consideration is stationary as well as for ARMA model identification.

The PV‑WAVE IMSL Statistics routines AUTOCORRELATION and PARTIAL_AC are methods that can be used to generate the required input to CORRELOGRAM. It should be noted that PARTIAL_AC takes as input results from AUTOCORRELATION and returns values associated with lags 1, ..., N, where N was the maximum lag considered by AUTOCORRELATION. The partial autocorrelation at lag 0 is always 1 (and the partial autocorrelation at lag 1 is equal to the autocorrelation at lag 1). To facilitate visualizing the autocorrelations and partial autocorrelations values on a common set of axes (where the ordinate from ranges –1 to 1 and the abcissa ranges from 0 to N) when the Pacf keyword is set a value of 1 is automatically prepended to the input for plotting.

Example

; Initialize the IMSL Statistics Library
@stat_startup
N = 100
nparams = [3, 2]
ar = [0.7, 0.4, -0.25]
ma = [-0.5, -0.25]
; Generate a time series
Y = RANDOM_ARMA(N, nparams, ar, ma)
WINDOW, Xsize=700, Ys=400, /Free, Title='Raw Series'
PLOT, Y, Xtitle='Time', Title='RANDOM_ARMA(3,2) Realization'
; Compute the sample autocorrelation function
y_acfs = AUTOCORRELATION(Y, 14)
y_pacfs = PARTIAL_AC(y_acfs)
PRINT, N_ELEMENTS(y_acfs), N_ELEMENTS(y_pacfs)

TEK_COLOR
; Use hardware fonts
!P.Font = 0
; Show two plots in the same window
!P.Multi=[0,0,2]
WINDOW, Xsize=700, Ys=400, /Free, Title='Correlograms'
CORRELOGRAM, y_acfs, N, Conf_Color=WoColorConvert(14), $
   Highlight=WoColorConvert(2), Ytitle='ACF'
CORRELOGRAM, y_pacfs, N, /Pacf, Conf_Color=WoColorConvert(14), $
   Highlight=WoColorConvert(2), Ytitle='PACF'
; Reset !P.Multi to one plot per page
!P.Multi = 0