[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Interval censored survival and stpm or intcens-correction

From   Steven Samuels <>
Subject   Re: st: Interval censored survival and stpm or intcens-correction
Date   Mon, 10 Sep 2007 17:29:52 -0400

loss leader
------------------------------------------------------------------------ ---------
My original code contained an error--I did not specify the proper end interval for censored observations. The corrected version is below. That said, unless Sharon has a lot of intervals, or needs to predict for time units finer then months, she should also run -pgmhaz8- the grouped proportional hazards model, available at SSC. Beware that gremlins may appear when code from a mail message, even plain text, is copied.

Following is code which will convert stset data to a form that - intcens- can use.

/*************************CODE FOLLOWS ***************/

drop _all
set more off
capture log close
log using sharon01, replace text

input id month status
1 0 0
1 6 0
1 12 1
2 0 0
2 6 0
2 12 0
2 18 1
3 0 0
3 6 0
3 12 0

/* First identify people with event */
egen event=max(status), by(id)
tempfile temp0
save `temp0'

/* Intervals for people with events */

/* Start of interval */
keep if status==0 & event==1
bysort id (month): keep if _n==_N
rename month t0
tempfile temp1
save `temp1'

/* End of interval */
use `temp0',clear
keep if status==1
bysort id (month): keep if _n==1
rename month t1
merge id using `temp1'
tab _merge
drop _merge
tempfile temp3
save `temp3'

/* Censored observations-start of observation */
use `temp0', clear
keep if event==0
egen t0=min(month), by(id)
bysort id: keep if _n==1
drop month
tempfile temp4
save `temp4'

/* Censored observations- end of observation */

use `temp0', clear
keep if event==0
egen t1=max(month), by(id)
bysort id:keep if _n==1
drop month
merge id using `temp4'
drop _merge
append using `temp3'
sort id
list id event t0 t1

On Sep 7, 2007, at 12:42 AM, Sharon Minnick wrote:


I have been attempting to analyze my interval censored survival data with either stpm or intcens ado's (From SSC). Both programs have been used in published papers (stpm: Royston and Parmar 2002; intcens: Griffin et al 2006). However, unless I am missing something, they don't seem able to handle multiple records per subject. In my study, subjects are bled and their serology checked at 6 month intervals. I want to be able to use the intervals when they were negative (and at risk) as well as the interval ending in seroconversion (or censoring) and I don't want to make only one interval per subject where some intervals will then be 2 or 3 years long. Does anyone have experience using either of these ado's in such a situation?
My data is in the span format with multiple records per subject. For each subject, _t0 is the first date of the span and _t is the second date of the span. There are no gaps, so _t for the first span is equal to _t0 for the second span.

In the intcens ado, the interval is specified as t0 and t1, there is no subject identifier. Intcens does not use stset parameters so I would lose some of the structure of my data.

For stpm, I have tried to define the left variable to specify that the observations are interval-censored by using _t0 as the left variable (which is < _t so according to the help file, when _d is 0, this will specify late entry at _t0 and right censoring at _t and when d is 1, this will specify interval censoring with an event in [_t0, _t]. I always receive the error message "

If anyone has used these ado files with interval censored data with multiple records per subject, I would appreciate a note as to whether or not it worked (and how to set it up).


Sharon Minnick
University of California at Davis

* For searches and help try:
Steven  Samuels
18 Cantine's Island
Saugerties, NY 12477
Phone: 845-246-0774
EFax: 208-498-7441

*   For searches and help try:

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