Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
55 views

Code For Cross Correl

The bl_xcorr command calculates cross correlations and p-values between two time series variables at different lags. By default, it calculates Pearson correlations. It saves the results in system macros including the correlation coefficients and p-values between the variables and their lags. The command is an updated version of xcorr that resolves naming conflicts with Stata's new xcorr command through version control.

Uploaded by

Anonymous RQQTvj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Code For Cross Correl

The bl_xcorr command calculates cross correlations and p-values between two time series variables at different lags. By default, it calculates Pearson correlations. It saves the results in system macros including the correlation coefficients and p-values between the variables and their lags. The command is an updated version of xcorr that resolves naming conflicts with Stata's new xcorr command through version control.

Uploaded by

Anonymous RQQTvj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

https://www.stata.com/users/becketti/tslib/bl_xcorr.

hlp

Cross correlations with p-values (STB-13: sts3)


--------------------------------

Under version 5.0:

^xcorr^ var1 var2 [^if in^ , ^l^ags(#) {^k^endall | ^p^earson | ^s^pearman}


]

Under version 6.0:

^bl_xcorr^ var1 var2 [^if in^ , ^l^ags(#) {^k^endall | ^p^earson |


^s^pearman} ]

calculates cross correlations--that is, correlations at various lags--of


var1 and var2. By default, Pearson correlations are calculated. p-values
are displayed along with the correlation coefficients.

Version control
---------------

In order to handle the naming conflict between this command and the new
Stata 6 time-series command ^xcorr^, the Stata 6 ^xcorr^ command resolves
the conflict using version control. For example, the Becketti library command
^xcorr^ may be invoked as follows in Stata 6:

. ^version 5.0^
. ^xcorr x1 x2, lags(3) k

Alternatively, you can access this command directly using its new name:

. ^bl_xcorr x1 x2, lags(3) k^

Options
-------
^l^ags(#) specifies the number of lagged cross-correlations to display.

^k^endall | ^p^earson | ^s^pearman indicates which correlation coefficient


to calculate. The default is ^p^earson.

Saved results
-------------

^xcorr^ saves its results in the system 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
.
.
.

Note
----

^xcorr^ calls the programs ^lag^, ^period^, and ^_ts_peri^ supplied in


sts2 (STB-7) and the programs ^pearson^ and ^spear^ supplied in

1 of 2 26/1/20, 8:49 pm
https://www.stata.com/users/becketti/tslib/bl_xcorr.hlp

sg5.1 (STB-13). These programs must be in the ado path specified by


S_ADO for ^xcorr^ to execute.

Author
------

Sean Becketti, Stata Technical Bulletin

Also see
--------

STB: ^sts3 (STB-13)^


Manual: ^[R] xcorr^
On-line: help for @xcorr@

2 of 2 26/1/20, 8:49 pm

You might also like