Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
AW: st: RE: RE: AW: correlate lag variables |

Date |
Tue, 11 May 2010 13:05:43 +0200 |

<> "...as the two of you have explained." The credit for this statement should go to Peter and Nick, though, who made almost identical comments to this effect. My code did not specifically address this point. HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Julia Gesendet: Dienstag, 11. Mai 2010 12:51 An: statalist@hsphsun2.harvard.edu Betreff: Re: st: RE: RE: AW: correlate lag variables Dear Nick and Martin, thank you for the usefull comments! Indeed I have a panel data, so the more lags I include in the correlate command, less data is being used, as the two of you have explained. Best regards, Julia On Mon, May 10, 2010 at 6:54 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote: > Yes; and I conjectured that the loss of 40 obs reflected a use of panel data. The original poster has yet to respond. > > Nick > n.j.cox@durham.ac.uk > > Lachenbruch, Peter > > 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. > > Martin Weiss > > 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 > ************* > > Julia > > 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? > > * > * 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/

**References**:**st: correlate lag variables***From:*Julia <j.statalist@gmail.com>

**st: RE: AW: correlate lag variables***From:*"Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu>

**st: RE: RE: AW: correlate lag variables***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: RE: AW: correlate lag variables***From:*Julia <j.statalist@gmail.com>

- Prev by Date:
**RE: st: RE: RE: AW: correlate lag variables** - Next by Date:
**RE: st: How can I put the numerical values of a variable into a numlist?** - Previous by thread:
**RE: st: RE: RE: AW: correlate lag variables** - Next by thread:
**Re: st: RE: RE: AW: correlate lag variables** - Index(es):