Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Interval Censored Data Formatting and Intcens

From   Steve Samuels <>
Subject   Re: st: Interval Censored Data Formatting and Intcens
Date   Sat, 2 Jun 2012 21:17:39 -0400

You are asked in the FAQ to say where you obtained unofficial commands.
-intcens- can be downloaded from SSC.

You say you want to transfer the structure of your data to Stata, but you
don't show that structure, so we have to guess. I'm guessing that your basic
data looked something like that after the input statement below ( "wide form").
If not, it might look something like the listed data after the -reshape- command
(below), the "long form" If not that either, then you will have to put  your data into one of the two forms.

For the wide form: let i = 1,3,13, 21 index
coses and let statusi = observation just after dose i

= 1 if death after dose i
= 0 if no death after dose i
= . no dose i given

*************CODE BEGINS*************
input id status1 status3 status13 status21
1 0 1 . .
2 0 0 1 .
3 0 0 0 1
4 0 0 . 1
5 0 . . 0

reshape long status, i(id) j(dose)
drop if status==.
list, sepby(id)  // long form

egen event = max(status), by(id)
gen t1 = dose if status==1

bysort id: gen t0 = dose[_n-1] if status==1
bysort id: keep if _n==_N
replace t0 = dose if t0==.
list id t0 t1 status
***********CODE ENDS***************

This is an interesting application of -intcens-, but
two points concern me.

1. You apparently applied 2+
doses to the each subject. If the effect of former
dosing persists in any way, then the probability
of an event will not depend only on current dose.

2. Dosing in groups could result in dependent

I am curious: Can you provide a methodological
reference for this design?


On Jun 1, 2012, at 5:12 PM, Ciril Bosch-Rosa wrote:

I am trying to apply survival analysis in an environment where I can gather
data in a very limited way. I have been looking at literature on how to
manage the data but am not being successful at transmitting the structure of
my data to Stata.

It turns out that my data is very limited because I can only observe once in
time each subject. I am taking this as an interval censored problem, where
all subjects start being at risk at t_0 and then are censored until I look
at some of them at (say) t_13, where they are either 1 (dead) or 0 (right
censored). So, either the subject died at some before (and including) t_13
or he survived in which case I will never see him again (hence the right

I looked at Cleves et al. but they are not clear on how I can tell Stata
that an even happened while "I was not looking". They tell me how to tell
stata I was not looking, but not how to tell I was not looking & something

id   t_0   t_1   event
1     1      3      0 
1     13    15    1

the example above I tell stata there is a censored interval from t=3 until
t=13 and then I observe id=1 until he gets a failure at t=15, but I am not
able to tell stata that they might have died in the t3-t13 interval:

id   t_0   t_1   event
1     1      3      0 
1     13    13    1
2     1      3      0
2     13    13     0

In other words I observe you from t=1 to t=3 and then you get censored until
I get one  peek at t=13, where I can see if you died between 3 and 13 or

I believe this can be done with ""intcens  depvar1 depvar2 " where depvar
are my t=3 and t=13 respectively, my problem though is that there are
different interval censoring for different subjects

id   t_0   t_1   event
1     1      3      0 
1     13    13    1
2     1      3      0
2     13    13     0
3     1      3      0
3     21    21    1
4     1      3      0
4     21    21     1

how can I tell intcens, "intcens depvar1 depvar2 if id=1|2 but depvar1
depvar3 if id=3|4" ??

Any help/advice is welcome


PS If you are wondering in what environment I get this kind of data; this is
a lab experiment where I apply a dose to groups of subjects and get
instantaneous results, hence my observing groups of them at the same "time".
My X-axis is not time, but rather "dosage" and I am trying to plot the
survivor curve given the very limited observable outcomes for each dosage.

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index