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

From |
Maarten buis <maartenbuis@yahoo.co.uk> |

To |
statalist@hsphsun2.harvard.edu |

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 observation. 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 -------------- clear 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 end // 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: http://www.maartenbuis.nl/stata/exampleFAQ.html ) Hope this helps, Maarten -------------------------- Maarten L. Buis Institut fuer Soziologie Universitaet Tuebingen Wilhelmstrasse 36 72074 Tuebingen Germany http://www.maartenbuis.nl -------------------------- * * 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/

**Follow-Ups**:**Re: st: Events before D: how do I analyse?***From:*Tim <lists@timbp.com>

**References**:**st: Events before D: how do I analyse?***From:*Tim <lists@timbp.com>

- Prev by Date:
**st: R2 with xtreg, re** - Next by Date:
**st: Error in egen rank(), unique?** - Previous by thread:
**st: Events before D: how do I analyse?** - Next by thread:
**Re: st: Events before D: how do I analyse?** - Index(es):

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