Stata 15 help for xcorr

[TS] xcorr -- Cross-correlogram for bivariate time series

Syntax

xcorr varname1 varname2 [if] [in] [, options]

options Description ------------------------------------------------------------------------- Main generate(newvar) create newvar containing cross-correlation values table display a table instead of graphical output noplot do not include the character-based plot in tabular output lags(#) include # lags and leads in graph

Plot base(#) value to drop to; default is 0 marker_options change look of markers (color, size, etc.) marker_label_options add marker labels; change look or position line_options change look of dropped lines

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 xcorr; see [TS] tsset. varname1 and varname2 may contain time-series operators; see tsvarlist.

Menu

Statistics > Time series > Graphs > Cross-correlogram for bivariate time series

Description

xcorr plots the sample cross-correlation function.

Options

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

generate(newvar) specifies a new variable to contain the cross-correlation values.

table requests that the results be presented as a table rather than the default graph.

noplot requests that the table not include the character-based plot of the cross-correlations.

lags(#) indicates the number of lags and leads to include in the graph. The default is to use min{floor(n/2) - 2, 20}.

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

base(#) specifies the value from which the lines should extend. The default is base(0).

marker_options, marker_label_options, and line_options affect the rendition of the plotted cross-correlations.

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.

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

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

addplot(plot) provides a way to add other 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 for saving the graph to disk (see [G-3] saving_option).

Examples

Setup . webuse furnace

Plot the cross-correlation function . xcorr input output

Same as above, but draw vertical line at 5 . xcorr input output, xline(5)

Same as above, but include 30 lags and leads in the graph . xcorr input output, xline(5) lags(30)

Obtain table of autocorrelations and character-based plot of cross-correlations . xcorr input output, table


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