[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: command: stpiece |

Date |
Fri, 22 Feb 2008 11:07:21 +0000 (GMT) |

--- Mussida Chiara <chiara.mussida@unicatt.it> wrote: > I'm trying to sort out a specification issue for stpiece analysis. > More precisely I must estimate a piecewise constant hazard model for > U duration (survival analysis). This, as you know, means to specify > piece in which the dependent variable (for my model it is the > unemployment duration, measured in months) is constant. The problem > arise since, as stata help suggests: > The data must be st. In order to create time pieces, an id variable > must be declared with stset. See st and stset. > Now: is the id variable an additional variable to ne generated, or it > simply refers to my dependent variable and therefore to the precise > turning point that I want to specify?? this point for me is the > median of the dependent variable distrn, and in a successive > estimations there will be more time intervals dictated by the > relative frequency of the observations... First of all -stpiece- is not part of official Stata. It realy helps if you tel us where you got this program form, so we can be sure that we are all talking about the same program. For now I assume you are using the version from -ssc-. The id variable you can specify in -stset- is a variable that identifies the respondent. In survival analysis, the same person can appear in multiple rows in your dataset, actually -stpiece- depends on this fact. The id variable tells Stata which row belongs to which individual. If you start with a "one row per person" dataset than the id variable may be absent. In that case you can make one using: gen long id = _n _n is the current observation number, so the first person will get the value 1, the second 2, etc. I have given this variable the datatype long to make sure that this will work in large datasets (upto aprox. 2,000,000,000 individuals) (for more on this issue see here: http://www.ats.ucla.edu/stat/Stata/faq/longid.htm ) I have added a working at the bottom of this post. For more on preparing your data for survival analysis see this excelent course website by Stephen Jenkins: http://www.iser.essex.ac.uk/teaching/degree/stephenj/ec968/ Hope this helps, Maaten *------------------ begin example ------------- sysuse cancer, clear gen long id = _n stset studytime, failure(died) id(id) xi: stpiece age i.drug, tp(5 10 20) *------------------- end example --------------- (For more on how to use examples I sent to the Statalist, see http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html ) ----------------------------------------- Maarten L. Buis Department of Social Research Methodology Vrije Universiteit Amsterdam Boelelaan 1081 1081 HV Amsterdam The Netherlands visiting address: Buitenveldertselaan 3 (Metropolitan), room Z434 +31 20 5986715 http://home.fsw.vu.nl/m.buis/ ----------------------------------------- __________________________________________________________ Sent from Yahoo! Mail. A Smarter Inbox. http://uk.docs.yahoo.com/nowyoucan.html * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**RIF: st: command: stpiece***From:*"Mussida Chiara" <chiara.mussida@unicatt.it>

**References**:**st: command: stpiece***From:*"Mussida Chiara" <chiara.mussida@unicatt.it>

- Prev by Date:
**st: command: stpiece** - Next by Date:
**st: Heckman probit model with endogenous explanatory variables** - Previous by thread:
**st: command: stpiece** - Next by thread:
**RIF: st: command: stpiece** - Index(es):

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