Calculate and graph cross-correlation function -----------------------------------------------
^xcorplot^ var1 var2 [^if^ exp] [^in^ range] [^, l^ags^(^#^)^ { ^k^endall | ^p^earson | ^s^pearman } ^nop^rint ^sp^ike ^ci^ graph_options ]
Description ------------
^xcorplot^ calculates and graphs the first ^lags()^ cross-correlations of var1 and var2, both positive and negative.
Remarks --------
It is the user's responsibility to ensure that data are in appropriate sort order (usually, but not necessarily, time order).
^xcorplot^ is built on Sean Becketti's ^xcorr^ and requires other programs from his time series library to be installed.
Options --------
^lags(^#^)^ specifies the number of lags. If not specified, the first 5 cross-correlations are graphed.
^kendall^ | ^pearson^ | ^spearman^ indicates which correlation coefficient to calculate. The default is ^pearson^.
^noprint^ suppresses printing of the numeric results.
^spike^ causes the cross-correlations to be shown as a series of spikes drawn vertically from zero.
^ci^ adds approximate confidence interval bands to the graph at +/- 2 sqrt(number of data).
graph_options refers to any of the options of ^graph, twoway^.
Example --------
. ^xcorplot runoff rainfall^
Saved results --------------
^xcorplot^ saves its results in the macros S_1, ... :
^S_1^ Correlation between var1 and var2 ^S_2^ p-value of correlation between var1 and var2 ^S_3^ Correlation between L.var1 and var2 ^S_4^ p-value of correlation between L.var1 and var2 ^S_5^ Correlation between var1 and L.var2 ^S_6^ p-value of correlation between var1 and L.var2 . . .
Authors --------
Nicholas J. Cox, University of Durham n.j.cox@@durham.ac.uk
Aurelio Tobias, IMIM, Barcelona atobias@@imim.es
after Sean Becketti's ^xcorr^.