Stata 15 help for ac

[TS] corrgram -- Tabulate and graph autocorrelations

Syntax

Autocorrelations, partial autocorrelations, and portmanteau (Q) statistics

corrgram varname [if] [in] [, corrgram_options]

Graph autocorrelations with confidence intervals

ac varname [if] [in] [, ac_options]

Graph partial autocorrelations with confidence intervals

pac varname [if] [in] [, pac_options]

corrgram_options Description ------------------------------------------------------------------------- Main lags(#) calculate # autocorrelations noplot suppress character-based plots yw calculate partial autocorrelations by using Yule-Walker equations -------------------------------------------------------------------------

ac_options Description ------------------------------------------------------------------------- Main lags(#) calculate # autocorrelations generate(newvar) generate a variable to hold the autocorrelations level(#) set confidence level; default is level(95) fft calculate autocorrelation by using Fourier transforms

Plot line_options change look of dropped lines marker_options change look of markers (color, size, etc.) marker_label_options add marker labels; change look or position

CI plot ciopts(area_options) affect rendition of the confidence bands

Add plots addplot(plot) add other plots to the generated graph

Y axis, X axis, Titles, Legend, Overall twoway_options any options other than by() documented in [G-3] twoway_options -------------------------------------------------------------------------

pac_options Description ------------------------------------------------------------------------- Main lags(#) calculate # partial autocorrelations generate(newvar) generate a variable to hold the partial autocorrelations yw calculate partial autocorrelations by using Yule-Walker equations level(#) set confidence level; default is level(95)

Plot line_options change look of dropped lines marker_options change look of markers (color, size, etc.) marker_label_options add marker labels; change look or position

CI plot ciopts(area_options) affect rendition of the confidence bands

SRV plot srv include standardized residual variances in graph srvopts(marker_options) affect rendition of the plotted standardized residual variances (SRVs)

Add plots addplot(plot) add other plots to the generated graph

Y axis, X axis, Titles, Legend, Overall twoway_options any options other than by() documented in [G-3] twoway_options -------------------------------------------------------------------------

You must tsset your data before using corrgram, ac, or pac; see [TS] tsset. Also, the time series must be dense (nonmissing and no gaps in the time variable) in the sample if you specify the fft option. varname may contain time-series operators; see tsvarlist.

Menu

corrgram

Statistics > Time series > Graphs > Autocorrelations & partial autocorrelations

ac

Statistics > Time series > Graphs > Correlogram (ac)

pac

Statistics > Time series > Graphs > Partial correlogram (pac)

Description

corrgram produces a table of the autocorrelations, partial autocorrelations, and portmanteau (Q) statistics. It also displays a character-based plot of the autocorrelations and partial autocorrelations. See [TS] wntestq for more information on the Q statistic.

ac produces a correlogram (a graph of autocorrelations) with pointwise confidence intervals that is based on Bartlett's formula for MA(q) processes.

pac produces a partial correlogram (a graph of partial autocorrelations) with confidence intervals calculated using a standard error of 1/sqrt(n). The residual variances for each lag may optionally be included on the graph.

Options for corrgram

+------+ ----+ Main +-------------------------------------------------------------

lags(#) specifies the number of autocorrelations to calculate. The default is to use min{floor(n/2) - 2, 40}, where floor(n/2) is the greatest integer less than or equal to n/2.

noplot prevents the character-based plots from being in the listed table of autocorrelations and partial autocorrelations.

yw specifies that the partial autocorrelations be calculated using the Yule-Walker equations instead of using the default regression-based technique. yw cannot be used if srv is used.

Options for ac and pac

+------+ ----+ Main +-------------------------------------------------------------

lags(#) specifies the number of autocorrelations to calculate. The default is to use min{floor(n/2) - 2, 40}, where floor(n/2) is the greatest integer less than or equal to n/2.

generate(newvar) specifies a new variable to contain the autocorrelation (ac command) or partial autocorrelation (pac command) values. This option is required if the nograph option is used.

nograph (implied when using generate() in the dialog box) prevents ac and pac from constructing a graph. This option requires the generate() option.

yw (pac only) specifies that the partial autocorrelations be calculated using the Yule-Walker equations instead of using the default regression-based technique. yw cannot be used if srv is used.

level(#) specifies the confidence level, as a percentage, for the confidence bands in the ac or pac graph. The default is level(95) or as set by set level.

fft (ac only) specifies that the autocorrelations be calculated using two Fourier transforms. This technique can be faster than simply iterating over the requested number of lags.

+------+ ----+ Plot +-------------------------------------------------------------

line_options, marker_options, and marker_label_options affect the rendition of the plotted autocorrelations (with ac) or partial autocorrelations (with pac).

line_options specify the look of the dropped lines, including pattern, width, and color; see [G-3] line_options.

marker_options specify the look of markers. This look includes the marker symbol, the marker size, and its color and outline; see [G-3] marker_options.

marker_label_options specify if and how the markers are to be labeled; see [G-3] marker_label_options.

+---------+ ----+ CI plot +----------------------------------------------------------

ciopts(area_options) affects the rendition of the confidence bands; see [G-3] area_options.

+----------+ ----+ SRV plot +---------------------------------------------------------

srv (pac only) specifies that the standardized residual variances be plotted with the partial autocorrelations. srv cannot be used if yw is used.

srvopts(marker_options) (pac only) affects the rendition of the plotted standardized residual variances; see [G-3] marker_options. This option implies the srv option.

+-----------+ ----+ Add plots +--------------------------------------------------------

addplot(plot) adds specified plots to the generated graph; see [G-3] addplot_option.

+-----------------------------------------+ ----+ Y axis, X axis, Titles, Legend, Overall +--------------------------

twoway_options are any of the options documented in [G-3] twoway_options, excluding by(). These include options for titling the graph (see [G-3] title_options) and saving the graph to disk (see [G-3] saving_option).

Examples

Setup . webuse air2

List autocorrelations, partial autocorrelations, and Q statistics . corrgram air, lags(20)

Graph the autocorrelations . ac air

Graph the partial autocorrelations of differenced and seasonally differenced series . pac DS12.air, lags(20) srv

Video example

Correlograms and partial correlograms

Stored results

corrgram stores the following in r():

Scalars r(lags) number of lags r(ac#) AC for lag # r(pac#) PAC for lag # r(q#) Q for lag #

Matrices r(AC) vector of autocorrelations r(PAC) vector of partial autocorrelations r(Q) vector of Q statistics


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index