Dear Maaten,
I forgot to specify (sorry about that...) that mydownloaded stpiece command (ado + help) is the version from Jesper B. Sorensen ( [email protected] <mailto:[email protected]> ) (University of Chicago Graduate School of Business), freely available on the web.
I know that id variables help to identify individuals in your dataset. And fortunately, as you correctly assume, my dataset is a "one row per person" type. That's why I was asking about the meaning of an id for my data...Therefore in my case it will be equal to my total observations...
I'm going to try in this way, the example above is really useful and I hope proper for my data...I will let you know!!
another issue is related to the proper identification of time intervals at which specify pieces: as understood from literature on this topic, there are no precise rules to follow , but it simply is related to relative frequencies of the observations in the case of multiple time intervals. In the case of only 2 intervals, instead, the median of the distribution is preferred.
Thanks, thanks, thanks,
chiara
-----Messaggio originale-----
Da: [email protected] per conto di Maarten buis
Inviato: ven 22/02/2008 12.07
A: [email protected]
Cc:
Oggetto: Re: st: command: stpiece
--- Mussida Chiara <[email protected]> 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/
<<winmail.dat>>