Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: st: Interval Censored Data Formatting and Intcens

From   Steve Samuels <>
Subject   Re: st: st: Interval Censored Data Formatting and Intcens
Date   Mon, 4 Jun 2012 19:23:24 -0400

I think you can omit the words "might have" in your statement "My example might have induced to confusion...". It did.  Also with only one observation per person
the data are in long form.

If you administered only one treatment per subject, then you have a standard
bioassay problem, in which each organism has a latent threshold for response.
Note that the log logistic & log-normal models fitted by -intcens- include 
a scale parameter, but the models in -logistic- and -probit- do not.

If you use -intcens-, specify  the censoring interval for an
observation with dose d as (0+,d]. Here 0+ is some small positive 
number like 0.01. That you have no events at dose = 3 is immaterial.

However because there are few doses, -intcens- might have
difficulty converging. Also, how are you going to plot the
dose response curve and standard errors?

I suggest that instead you use  -probit- and -logit-.
You will have a better chance of obtaining convergence and can
generate the plotted curves and standard errors, Here is code
 which shows how to interpolate absent doses for plotting.

*************CODE BEGINS*************
input trunk //fakes for auto data
gen fake=1
tempfile t1
save `t1'
sysuse auto, clear
gen domestic = foreign==0
sum trunk // minimum is 5
append using `t1'
logistic domestic trunk if missing(fake)
predict pr //predicts for fake data too
scatter pr trunk, c(direct) m(i)
***********CODE ENDS**************


On Jun 4, 2012, at 2:08 PM, Ciril Bosch wrote
Hi Steve,
thank you for your reply, I really appreciate it. Indeed intcens comes from SSC.

My data is in a wide format and reads:

id dose event session

Where session stands for ordered session when doses where applied

In my example:

id   dose   event   session
1      13       1          1
2      13       0          2
3      21       1          1
4      21       1          2

My example might have induced to confusion as I was unclear in my

1) I don't actually apply two dosages to subjects. The t_0==1 and
t_1==3 that I have for all subjects is actually a "dummy treatment"
which never took place. I used it as a primitive way of telling Stata
that there is left censoring and that it should take that into account
(I do know that
dose==3 will always have event==0 for all subjects).

2) Treatments are completely independent across subjects even if they
are dosed in "batches". A dummy for session will be included in the
analysis, but this is just for the sake of completeness (or so I

So as you can see my design cannot be simpler; select a small set of
doses to apply and then observe results on a series of subjects.

I will try the code you sent once I get onto my computer and see if I
can run it with intcens.

Again, thanks for your help,

On Sat, Jun 2, 2012 at 6:17 PM, Steve Samuels <> wrote:

> 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
> end
> 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 responses.
> I am curious: Can you provide a methodological reference for this
> design?
> Steve
> On Jun 1, 2012, at 5:12 PM, Ciril Bosch-Rosa wrote:
> Hello,
> 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 censoring).
> 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
> happened:
> 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 not.
> 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
> Ciril
> 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–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index