Bookmark and Share

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]

Re: st: RE: Using lagged variables in panel data analysis


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Using lagged variables in panel data analysis
Date   Wed, 18 Jan 2012 01:06:47 +0000

No; I don't mean that.

First, -tsset- (or -xtset-) is not a prerequisite for using subscripts.

Second, I am as said recommending -tsset- (or -xtset-) followed by
time series operators such as L.

Time series operators do the right thing with panels and they do the
right thing with gaps in the data.

This is all well documented: e.g. start with -help tsvarlist-.

Nick

On Wed, Jan 18, 2012 at 12:16 AM, Edward James <ej111005@gmail.com> wrote:
> Thank you Nick.
>
> You mean do I have to conduct -tsset- command first and then make
> lagged variables using -x[_n-1]-?
>
>
>
> 2012/1/18 Nick Cox <n.j.cox@durham.ac.uk>:
>> It is usually better to create lagged variables with panel data using -tsset- or -xtset- followed by L.
>>
>> You will always have the problem that there is no value before the first.
>>
>> -drop-ping the first in each panel just makes your plight worse by throwing away some of your data. It can't solve this problem.
>>
>> On the whole, you need do nothing here: Stata's time series and panel commands do what they can with missing values, which usually means ignoring them.
>>
>> Nick
>> n.j.cox@durham.ac.uk
>>
>> Edward James
>>
>> I have a question for conducting a panel data analysis.
>>
>> I make some lagged variables using "x[_n-1]" commands from 1980 to
>> 2007 and want to conduct GLS.
>>
>> When I make lagged variables, is the case of the first period supposed
>> to be "."? But it has a unknown value as you can see below.
>>
>>
>>        +----------------------------------------+
>>        country   year   cpiannual   lcpiann~l
>>        ----------------------------------------
>> 197.    Germany   1980    5.441055    1.488074
>> 198.    Germany   1981    6.344242    5.441055
>> 199.    Germany   1982    5.241046    6.344242
>> 200.    Germany   1983    3.293413    5.241046
>> 201.    Germany   1984    2.405797    3.293413
>>        ----------------------------------------
>>
>> In this case, should I drop the case of 1980?
>>

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index