On Mar 4, 2007, at 6:04 PM, mdelliot@ucsd.edu wrote:
Sorry, this is probably an obvious question, but I'm new at this.
Since you're new at this, let me ask a not so obvious question:
This isn't for a homework assignment, is it? If so, please read first:
<http://www.stata.com/support/faqs/res/statalist.html#advice>
If not, then I would suggest starting with -help time-.
I have a dataset that contains years, a dependent variable, and an
independent variable.
Then I would recommend you tell Stata that you have time-series
data. See help -tsset-. If your years are not in Stata date format,
see -help tdates-.
I would like to allow for possible time-delays in the
relationship, ...
Presumably by "time-delays" you mean a relationship between current
values of y (your dependent variable) and lagged values of x (your
independent variable, as you called it). Stata uses L.x to represent
x_{t-1}, that is the first lag of the x series. L2.x represents x_
{t-2}, and so on. See -help tsvarlist- for additional information.
...and I would like to test correlation. What is the best function
to accomplish this?
What specifically do you have in mind with "test correlation"? -
xcorr- will generate cross-correlations, but no test statistics. You
can find rules-of-thumb in any introductory graduate-level time
series textbook, however.
Perhaps you have a "Granger causality" test in mind? This can be
accomplished in Stata after estimating a -var-, but it really is just
a test of joint significance of the lags of x. That is, for example,
var y x, lags(1/3) small dfk
vargranger
and
reg y L(1/3).y L(1/3).x
testparm L(1/3).x
should give you exactly the same answer. You'll have to consider
what is the appropriate number of lags (as it ain't necessarily 3); -
varsoc- may assist here. Hope that helps.
-- Mike
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/