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

Re: st: Events before D: how do I analyse?

From   Maarten buis <>
Subject   Re: st: Events before D: how do I analyse?
Date   Tue, 3 Nov 2009 09:37:23 +0000 (GMT)

--- On Tue, 3/11/09, Tim wrote:
> It has been suggested that people in remote areas who
> require D move closer to services in the months before
> needing D (or in the next few months).
> Also, group A form a greater proportion of remote
> populations and are more likely to require D and are more
> likely to move.
> My dataset includes the area where the person was living at
> each observation (hospitalisation) time.
> I want to know if people in more remote areas are more
> likely to move (closer to services) in the 6 or 12 months
> before requiring D. I also want to know if people in group A
> are more likely to move (closer to services) in the 6 or 12
> months before requiring D.
> The data are left censored; they only include people who
> require D, but some of those require D on or before their
> first record, so I have no idea when they first required D.
> So I want to analyse events before the index (defining)
> event. Furthermore, I'm not actually interested in time; I
> want to know about incidence rates.

The first step would be to identify moves. A (long distance )move has
occuered when an individual lives in a different area than in the 
previous observation. In the example below, the variable area 
represents the area in which someone lives, the previous area can be
obtained by looking at area[_n-1] (_n is the current observation, 
_n-1 is the previous observation). We need to take care of the fact
that we only want to do this within each individual, this is what
the -bys id (visit)- does, the -(visit)- part makes sure that the 
observations are sorted by visit, so _n-1 is really the previous 

Since you don't care about the timing but only about the incidence 
ratios, you can then collapse the data, such that for each 
individual you have group membership and number of moves. This is
done below using the -collapse- command.

Than it is just a matter of estimating a -poisson-. To control for 
the number of times you observed each individual you can use the 
-exposure()- or -offset()- option. I don't use these models very
often, so I always mix these two up. I think the example below is
correct, but I recommend you pick up the manual and/or some textbook
to check it.

*----------------- begin example --------------
input id visit area group
1 1 1 1
1 2 1 1
1 3 2 1
1 4 2 1
2 1 2 1
2 2 3 1
2 3 4 1
2 4 4 1
3 1 3 2
3 2 4 2
3 3 4 2
3 4 4 2
4 1 5 2
4 2 5 2
4 3 5 2

// find instances of moving
bys id (visit) : gen byte move = area!=area[_n-1] if _n != 1

// create a dataset of number of moves per person
collapse (sum) move (count) expo=move (mean) group, by(id)

// estimate incidence rate ratios
poisson move group, exposure(expo) ir
*---------------- end example -----------------------------
( For more on how to use examples I sent to statalist see: )

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

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