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 |
Nick Cox <njcoxstata@gmail.com> |

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

Subject |
Re: st: Lagged variables query |

Date |
Tue, 9 Apr 2013 13:42:37 +0100 |

As you have panel data, you should -xtset- or -tsset- your data and define lagged variables using the L. operator. Using subscripts to define lagged values as you have done, or propose to do, risks errors if there are gaps in your data, and indeed complete nonsense if the lagged value for one panel is in fact taken to be some value for a different panel. This isn't the question you asked -- which I haven't tried to understand, as if it's a matter of what people do in a field not my own -- but it's a crucial detail. Nick njcoxstata@gmail.com On 9 April 2013 13:29, Mirnezami, Oliver <O.Y.Mirnezami@warwick.ac.uk> wrote: > Hi > > I'm investigating the effect of job loss on health in a panel dataset. I have an OLS model with individual fixed effects, year effects and a set of explanatory variables with health as the dependent variable. The main independent variable of interest is a treatment indicator variable that = 1 for the treatment group (individuals that have experienced job loss in the current wave) and = 0 for the control group (individuals that are employed in the current wave). > > My query is regarding the logic for analysing the lagged effect of job loss. > > I've used the following code to generate lags in what I would consider to be the 'normal way' in that everything is just shifted one period: > > forvalues i = 1/8 { > qui gen treatlag`i' = . > qui by id: replace treatlag`i' = treat [_n-`i'] > } > > The issue is that then the zeros (control groups) are no longer just assigned to the periods in which an individual is necessarily employed and so I am not sure whether it makes any sense to investigate this in this manner? This is exacerbated by the fact that my dataset is an unbalanced panel and since it is a health and retirement survey, there are a relatively large number of periods in which individuals are not in the labour force. I'm concerned that by shifting the zeros in this way, my control group is changing and so includes individuals who are not employed but may be retired for example and so the comparison isn't as 'clean' as the original unlagged treatment effect where I distinguish between employed individuals and those that have reported job loss in the current wave. > > The other idea I had was to essentially keep the control group for the lagged variables the same as for the main unlagged treatment variable (i.e. keep the position of the 0s as they were) and just shift the treatment values (i.e. just move the 1s): > > forvalues i = 1/8 { > qui gen treatlagg`i' = . > qui by id: replace treatlagg`i' = 0 if (treat ==0) > qui by id: replace treatlagg`i' = 1 if (treat[_n-`i']) ==1 > } > > I've had limited experience in dealing with lagged variables but have a feeling this is less of a conventional case so any advice on which approach (if any) makes sense would be much appreciated. > > Kind regards > > Oliver > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**RE: st: Lagged variables query***From:*"Mirnezami, Oliver" <O.Y.Mirnezami@warwick.ac.uk>

**References**:**st: Lagged variables query***From:*"Mirnezami, Oliver" <O.Y.Mirnezami@warwick.ac.uk>

- Prev by Date:
**Re: st: Odd ratio / relative risk in logistic regression** - Next by Date:
**Re: st: how to summarize a big matrix** - Previous by thread:
**st: Lagged variables query** - Next by thread:
**RE: st: Lagged variables query** - Index(es):