Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: stset problem, please help


From   deb@economics.rutgers.edu
To   statalist@hsphsun2.harvard.edu
Subject   st: stset problem, please help
Date   Tue, 3 May 2005 16:14:06 -0400

Dear Stata Experts,

I'm having some problem in stset-ing my panel data covering period from 1975 to
1999. This is how my data looks like:

Id	year	spell duration	censor	 x
1	1975	1	2	0	-0.67
1	1976	1		0	4.55
1	1977	0		0	2.68
1	1978	0		0	2.43
1	1979	0		0	3.23
1	1980	0		0	2.13
1	1981	1	2	0	-0.12
1	1982	1		0	-1.76
1	1983	0		0	0.34
1	1984	0		0	2.6
1	1985	0		0	2.58
1	1986	0		0	2.17
1	1987	0		0	2.54
1	1988	0		0	2.32
1	1989	0		0	2.29
1	1990	0		0	0.88
1	1991	0		0	1.32
1	1992	0		0	1.34
1	1993	0		0	1.66
1	1994	0		0	3.27
1	1995	0		0	2.52
1	1996	0		0	2.4
1	1997	0		0	2.72
1	1998	0		0	1.9
1	1999	0		0	-999
46	1975	0		0	0.5
46	1976	0		0	5.29
46	1977	0		0	2.1
46	1978	0		0	2.27
46	1979	0		0	2.53
46	1980	0		0	0.57
46	1981	1	4	0	-0.28
46	1982	1		0	-1.84
46	1983	1		0	1.1
46	1984	1		0	1.26
46	1985	0		0	0.19
46	1986	0		0	-0.49
46	1987	0		0	2.58
46	1988	0		0	3.6
46	1989	0		0	3.3
46	1990	0		0	2.2
46	1991	0		0	-0.17
46	1992	0		0	0.42
46	1993	0		0	0.41
46	1994	0		0	2.16
46	1995	0		0	3.9
46	1996	0		0	2.7
46	1997	1	3	1	1.62
46	1998	1		0	0.47
46	1999	1		0	-999



My failure variable is 'spell'. Failure occurs when spell = 0. And the
subject is at the risk of failure when spell=1. I'm interested in the
transition from spell=1 to spell=0. Consequently, once a failure occurs all the
subsequent failures are irrelevant until the subject is at risk again.

so when I specify the 'origin(spell==1)' , that command sets the first observed
spell=1 for that subject as origin. But ideally, that origin should change when
the same subject comes under the risk of failure again.

Another important thing is the duration of the risk of failure. For example, in
my first observation, in 1975 and 1976 the subject is under the risk of failure
and the failure is observed in 1977. So the duration of spell is 2 years and I
want stata to record the 'x' value corresponding to 1975. But from the -st
variable, I can see that stata is dropping that observation and retaining
observation after 1976 which is irrelevant.

And the '_d' variable is also surprising. It is supposed to denote the censored
observations. But many a times _d=1 when the observation is not censored. In my
data, censoring is an exogenous information which is captured by the variable
'censor'. When censor=1, then only that particular spell is censored.


I gave the following command:

stset year, id(cid) failure(spell==0) exit(year==1999) origin(spell==1) scale(1)

And I know that I'm doing it wrong. I tried the snapspan command as well. Is
there anyway, I can fix this problem.

I would appreciate any help that you can give me. Thank you very much in
advance.

Saubhik
















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



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