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

From |
Tim <lists@timbp.com> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Wed, 04 Nov 2009 20:15:24 +1100 |

Thank you, this helps a lot. Not exactly what I want, but all the info I need to produce what I want. Tim Maarten buis wrote:

--- 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 hasoccuered when an individual lives in a different area than in theprevious observation. In the example below, the variable arearepresents the area in which someone lives, the previous area can beobtained by looking at area[_n-1] (_n is the current observation,_n-1 is the previous observation). We need to take care of the factthat we only want to do this within each individual, this is whatthe -bys id (visit)- does, the -(visit)- part makes sure that theobservations are sorted by visit, so _n-1 is really the previousobservation.Since you don't care about the timing but only about the incidenceratios, you can then collapse the data, such that for eachindividual you have group membership and number of moves. This isdone below using the -collapse- command.Than it is just a matter of estimating a -poisson-. To control forthe number of times you observed each individual you can use the-exposure()- or -offset()- option. I don't use these models veryoften, 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/

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

**References**:**Re: st: Events before D: how do I analyse?***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**st: GLS estimation Stata vs PCGive** - Next by Date:
**WG: st: Inappropriate lines joining up between individuals in twoway line graph** - Previous by thread:
**Re: st: Events before D: how do I analyse?** - Next by thread:
**st: R2 with xtreg, re** - Index(es):

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