I am trying to fit a lognormal distribution on interval-censored data. Some of my intervals have a lower bound of zero. Unfortunately, it seems like survreg() cannot deal with lower bounds of zero, despite the fact that plnorm(0)==0 and pnorm(-Inf)==0 are well defined. Below is a short example to reproduce the problem. Does anyone know why survreg() must behave that way? Is there an alternate solution to this problem? Sincerely, Jerome Asselin library(survival) data(ovarian) newovarian <- ovarian newovarian$lower59 <- newovarian$futime-59 newovarian$time59 <- Surv(newovarian$lower59,newovarian$futime, event=rep(3,nrow(newovarian)),type="interval") survreg(time59~ecog.ps+rx,data=newovarian,dist="lognormal") #THIS DOES NOT WORK BECAUSE ONE OF THE LOWER BOUNDS IS ZERO #Error in survreg(time59 ~ ecog.ps + rx, data = newovarian, # dist = "lognormal") : # Invalid survival times for this distribution -- Jerome Asselin (J?r?me) Statistical Analyst British Columbia Centre for Excellence in HIV/AIDS St. Paul's Hospital 608 - 1081 Burrard Street Vancouver, British Columbia CANADA V6Z 1Y6 Email: jerome at hivnet.ubc.ca Phone: 604 806-9112 Fax: 604 806-9044
After receiving some feedback, I've realised that this slight modification corrects the problem, although I still can't think of a reason why it didn't work the first way I've done it. newovarian$time59[newovarian$lower59==0] <- Surv(59,NA,event=2,type="interval") #NOW THIS WORKS... newovarian$lower59 <- newovarian$futime-59 newovarian$time59 <- Surv(newovarian$lower59,newovarian$futime, event=rep(3,nrow(newovarian)),type="interval") newovarian$time59[newovarian$lower59==0] <- Surv(59,NA,event=2,type="interval") survreg(time59~ecog.ps+rx,data=newovarian,dist="lognormal") Thanks, Jerome On Thursday 27 February 2003 12:36, Jerome Asselin wrote:> I am trying to fit a lognormal distribution on interval-censored > data. Some of my intervals have a lower bound of zero. > Unfortunately, it seems like survreg() cannot deal with lower > bounds of zero, despite the fact that plnorm(0)==0 and > pnorm(-Inf)==0 are well defined. Below is a short example to > reproduce the problem. > > Does anyone know why survreg() must behave that way? > Is there an alternate solution to this problem? > > Sincerely, > Jerome Asselin > > library(survival) > data(ovarian) > newovarian <- ovarian > > newovarian$lower59 <- newovarian$futime-59 > newovarian$time59 <- Surv(newovarian$lower59,newovarian$futime, > event=rep(3,nrow(newovarian)),type="interval") > survreg(time59~ecog.ps+rx,data=newovarian,dist="lognormal") > #THIS DOES NOT WORK BECAUSE ONE OF THE LOWER BOUNDS IS ZERO > #Error in survreg(time59 ~ ecog.ps + rx, data = newovarian, > # dist = "lognormal") : > # Invalid survival times for this distribution
On Thu, 27 Feb 2003, Jerome Asselin wrote:> > I am trying to fit a lognormal distribution on interval-censored > data. Some of my intervals have a lower bound of zero. > Unfortunately, it seems like survreg() cannot deal with lower > bounds of zero, despite the fact that plnorm(0)==0 and > pnorm(-Inf)==0 are well defined. Below is a short example to > reproduce the problem. > > Does anyone know why survreg() must behave that way? > Is there an alternate solution to this problem?The code takes the log transformation of all the numbers and then checks that they are finite, which they aren't. Removing the checks gives NA answers, so I would guess that some part of the C code uses an computation that needs to be written differently to be valid for infinite arguments. You could maximise the loglikelihood directly with nlm or similar, or you could add a small epsilon to your data. If there really isn't a singularity at zero then this will work perfectly well. -thomas