[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

[no subject]

1. Spells are defined as contiguous blocks of 1s within each panel. 

2. Then gaps within spells are allowed that include one or two 0s or
are shorter than 21 days. 

How to do things like this is detailed in the paper. 

Uneven spacing is immaterial here if it doesn't matter to you. 


Clive Nicholas replied to Shantanu Nundy

>  I am working with panel data and am struggling to do manipulations
with the data given that the time differences between ob[n] and ob[n-1]
are not constant.Here is my specific problem at hand: I have a variable
that is either 1 or 0. I want to define an "episode" of 1, where episode
is defined the time between the first 1 and the last 1 that is followed
by at least three 0s AND over at least 21 days. From my list of 1s and
0s, I would to define a "episode_start" variable that is 1 for the start
of each episode and for a second variable "episode_day" to be 1 for all
days of an episode. The trouble is that in some cases the three 0s may
be over 5 days and other times over 25 days. If the three 0s are over 5
days, we need to checking more observations as long as the variable
remains 0 until 21 days has been reached.I have found a solution but it
is by no means elegant and consists of over 20 lines of the following
(where codigo is my panel variable, giardia is the 1 or 0 vari
>   le, giardia_i is the desire "episode_start" variable, and date is
time):by codigo: replace giardia_i=1 if count_result==1 & giardia==1 &
(date - date[_n-4] >= 21 | giardia[_n-4]==.) & giardia[_n-4]!=1by
codigo: replace giardia_i=1 if count_result==1 & giardia==1 & (date-
date[_n-5] >= 21 | date[_n-5]==.) & giardia[_n-4]!=1 & giardia[_n-5]!=1

The user-written -tsspell-, available from SSC, might be of use here.
However, I haven't used this routine, so I can't give you examples of
how to use it for your specific problem.

*   For searches and help try:

© Copyright 1996–2019 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index