Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: AW: correlate lag variables
From
"Lachenbruch, Peter" <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: AW: correlate lag variables
Date
Mon, 10 May 2010 09:50:55 -0700
I'm coning into this a little late, but did anyone notice that when you include lag 2 you have 225 observations and when you include only lag 1, you have 265. Setting es=e(sample) after the lag 2 analysis and rerunning the correlation for lag 1 if es==1 might shed some light on the problem.
Tony
Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Martin Weiss
Sent: Monday, May 10, 2010 1:24 AM
To: [email protected]
Subject: st: AW: correlate lag variables
<>
Try -pwcorr- instead:
*************
clear*
set obs 100
gen y=1
replace y =.6*y[_n-1]+rnormal() in 2/l
gen byte time=_n
tsset time
corr y L.y L2.y
pwcorr y L.y
pwcorr y L.y L2.y
*************
HTH
Martin
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Julia
Gesendet: Montag, 10. Mai 2010 10:17
An: [email protected]
Betreff: st: correlate lag variables
Dear all,
I would like to calculate the correlation between a variable and its
past values. Thus, I use the following command:
. correlate BI L1.BI L2.BI
(obs=225)
| L. L2.
| BI BI BI
-------------+---------------------------
BI|
--. | 1.0000
L1. | 0.0111 1.0000
L2. | 0.0647 0.0161 1.0000
However, if I only ask the correlation for the first lag, my result
differs....
. correlate BI L1.BI
(obs=265)
| L.
| BI BI
-------------+------------------
BI|
--. | 1.0000
L1. | 0.0174 1.0000
Why does excluding the second lag affect the correlation between the
variable and its first lag?
Best regards,
Julia
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/