# Thread: Survival Analysis with Interval Censored Data

1. ## Survival Analysis with Interval Censored Data

Dear All

I'm trying to do a survival analysis with interval censored data.

The data are basically eye pressure measurements at certain intervals (18 months, 2 years and 3 years) after an operation to reduce eye pressure.

The operation is said to have 'failed' if the pressure rises above a predetermined level at any of the examination points. Different levels are set to show survival curves at different stringencies of success, if that makes sense. So survival curves will be drawn for failure defined as greater than 15, greater than 18 and greater than 21.

Now, the data is interval censored in that we only know that someone failed between two clinic visits.

So, can anyone help me with how I should organise my data in, preferably SPSS, or, if necessary, in R, so that I can correctly draw the survival curves and do the survival analysis with interval censored data.

All examples I've seen so far of this assume that the data is not interval censored...

Many Thanks

Simon

2. ## Re: Survival Analysis with Interval Censored Data

Ok, the link below should get me started but any additional help would be greatly appreciated!

3. ## Re: Survival Analysis with Interval Censored Data

Ok finally did it..... so problem solved!

4. ## Re: Survival Analysis with Interval Censored Data

Dear R user friends

I have managed to solve my problem using R but I think that my workflow is currently a little inefficient.

I have a macro in Excel that reads the data and compares it to my cut-off pressure level. This macro creates 3 columns of data for the R surv function: time1, time2, event.

Event = 0 if right censored and 3 if interval censored.

I make this into a .csv file and read into R with:

I then have to separate this out with the following commands before I can do my final surv command

So I have to do

lefttimes=c(data1[(rep(1:51,each=1)),1])
righttimes=c(data1[(rep(1:51,each=1)),2])
myevents=c(data1[(rep(1:51,each=1)),3])

and finally

mysurv=Surv(lefttimes,righttimes,myevents,c("interval"))

and to produce the Kaplan-Meier plot

mysurvfit = survfit(mysurv~1)
plot(mysurvfit)

Now, can anyone tell me how I can read the .csv file directly into lefttimes, righttimes and myevents so I don't have to split up the data1 matrix as it feels quite inefficient.

Thank you!

Simon

5. ## Re: Survival Analysis with Interval Censored Data

You can use read.csv if it really is a csv file. You can use the col.names parameter if you don't have the header but want to specify column names while importing.

Is there a reason you're using rep(1:51, each = 1) instead of just 1:51? Also you don't need to wrap everything in c().

lefttimes <- data1[1:51, 1] should do the same thing. "inter val" is the same as c("inter val").

6. ## The Following User Says Thank You to Dason For This Useful Post:

SiBorg (03-10-2012)

7. ## Re: Survival Analysis with Interval Censored Data

Is there a reason you're using rep(1:51, each = 1) instead of just 1:51?
Because I really don't know what I'm doing with R at the moment! Have just ordered a book from Amazon so hopefully will get better with this.

Thanks for the hints - your version of the commands will be much simpler to type and edit!

I don't want to specify column names as such, I would ideally like to read each column directly into its correct variable name. Can I do this, or do I need to do the lefttimes <- data1[1:51, 1] thing for each variable?

Thanks again.

8. ## Re: Survival Analysis with Interval Censored Data

It's probably better practice to keep the data stored in the data frame since the data is logically grouped together in that fashion.

Code:
``````data1 <- read.csv("IOPless15.csv", header = FALSE, col.names = c("lefttimes", "righttimes", "myevents"))

mysurv <- with(data1, Surv(lefttimes, righttimes, myevents, "inter val"))

#of if you absolutely insist on being able to refer to them like
attach(data1)

mysurv <- Surv(lefttimes, righttimes, myevents, "inter val")``````

9. ## The Following User Says Thank You to Dason For This Useful Post:

SiBorg (03-10-2012)

10. ## Re: Survival Analysis with Interval Censored Data

The first two lines is what I really wanted to do but didn't know how. Thank you very much Dason.

11. ## Re: Survival Analysis with Interval Censored Data

One last question (I hope)

I now have two survival curves which I have plotted separately as follows:

plot(mysurvfit)
plot(mysurvfit2)

Can anyone tell me how to superimpose these plots with the second in a different colour?

12. ## Re: Survival Analysis with Interval Censored Data

Just choose a color number in ... as you want.

see R color chart:
http://research.stowers-institute.or...R/Color/Chart/

13. ## Re: Survival Analysis with Interval Censored Data

Does this work?

Code:
``````plot(mysurvfit)
lines(mysurvfit2, col = "red")``````
I haven't used survival in quite some time so I don't remember if that gives you what you want or not.

14. ## The Following User Says Thank You to Dason For This Useful Post:

SiBorg (03-10-2012)

15. ## Re: Survival Analysis with Interval Censored Data

Thanks Dason the col bit helped - I didn't know how to set colours

So I got it to work with

plot(mysurvfit)
par(new=TRUE)
plot(mysurvfit2, col = "red")

16. ## Re: Survival Analysis with Interval Censored Data

So here are my survival curves (see attached)

Can anyone tell me how I can extrapolate these to get an estimate of the median survival (with 95% confidence limits)?

Many thanks!

17. ## Re: Survival Analysis with Interval Censored Data

hi!!!
i'm doing exactly same as yours!!

glaucoma operations survival analysis...interval censoring...but my data is very raw. need to find left time and right time by myself...and also determine status

don't know how to do it

 Tweet

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts