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: shifting status variable


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: shifting status variable
Date   Fri, 19 Nov 2010 17:14:41 +0000

Good point. 

The trouble with observations in which the person is divorced in year 1 is that their status is ambiguous. If you do what I suggest, you would indeed mis-classify people previously divorced. If you do what Nick Sanders suggests, you would mis-classify people who really did get divorced in that year. So, you may be wrong either way in some fraction of cases. 

It follows that a third alternative is that the resultant variable should be left missing if -separati[1]- is 1, as there is no information on previous status to resolve the ambiguity. 

With rainfall data, which I have often worked with, I suspect people would follow the solution I recommend. If it rains on the first day of record, then this too can be regarded as the start of a rainy spell. However, divorce might well be treated differently. 

Nick 
[email protected] 

Nick Sanders

In this case, though, you'll want to avoid it that. I assume the variable is "1" any time an observation is "divorced". Since you don't have info from before the first year of the record, you can't tell if that person changed status in the first year or has been divorced for some time. Using the " | _n ==1" qualifier here would make everyone who was divorced in the first year of data be identified as a switcher, even if they'd been divorced for years (just not observed).

On Nov 19, 2010, at 8:55 AM, Nick Cox wrote:

> There is at least one small refinement here. Suppose someone got divorced in the first year of record. Then for that observation -separati- is 1 but -separati[_n-1]- evaluates to missing. Thus the condition for divorced this year should be 
> 
> separati == 1   &     separati[_n-1] == 0 | _n == 1
> 
> where the extra possibility _n == 1, under the aegis of -by:-, identifies the first observation of record. 
> 
> More general technique is discussed in 
> 
> SJ-7-2  dm0029  . . . . . . . . . . . . . . Speaking Stata: Identifying spells
>        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
>        Q2/07   SJ 7(2):249--265                                 (no commands)
>        shows how to handle spells with complete control over
>        spell specification
> 
> and (independently) encoded within -tsspell- from SSC. Either of these two sources could be of use if interest extends to e.g. lengths of time spent divorced. 
 
Nick Sanders
 
> This is a bit clunky, but it should do the trick (I imagine someone else has a cleaner way out there). Note this can't identify those who divorced in 2004, but you can't do that with your data anyway.
> 
> *Sort into individual/year order
> sort pb030 pb010
> 
> *Generate indicator for "Changed status this year"
> by pb030: gen divorced = (separati == 1 & separati[_n-1] == 0)
> 
> *Generate indicators for divorced in difference years
> foreach year in 2005 2006 2007 {
> 	gen divorced_`year'  = (divorced == 1 & pb010 == `year')
> }
> 
> That should do it (assuming you have no missing data)
 
On Nov 18, 2010, at 11:23 AM, Vincenzo Carrieri wrote:
 
>> I would like to create a dummy variable equals to one for persons
>> which decide to divorce in a given year.
>> I have a panel data with the following key variables:
>> 
>> pb010=year variable (2004, 2005, 2006, 2007)
>> separati=dummy variable equal to one for divorced persons (marital
>> status=divorced)
>> pb030=personal id
>> 
>> My question is: How is it possible to create a variable which takes
>> the value one if the person changes his marital status (from married
>> to divorced) in the year 2005 (with respect to 2004), 2006 (with
>> respect to 2005) and 2007 (with respect to 2006)?
>> 
>> My final concern is to build 3 variables: people divorced in 2005,
>> people divorced in 2006 and people divorced in 2007.

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