I have run a Weibull AFT survival analysis in R using survreg, and am now trying to predict time until a given percentage survival. I have created a vector of cumulative failure rates using for the 1:98th quartile, and can call up the time to a given failure rates for any of the quartiles. However, when I try and call up the corresponding survival rates, for quartiles below 0.35 R returns numeric(0). Can anyone please explain why?
Below is some of my code, although not a reproducible example - sorry. I made a small dummy dataset but didn't encounter the same problem.
> pct <- (1:98)/100
> survprobs<-predict(BtCatmodel1, newdata=data.frame(group="B"), type="quantile", p=pct)
> survprobs[(1-pct)==0.4]
[1] 12.39598 # 40% survival at 12.4 days
>survprobs[(1-pct)==0.3]
numeric(0) # ???
When I run the corresponding percentiles for the failure rates, both work fine.
> survprobs[pct==0.6]
[1] 12.39598 # 60% deaths at 12.4 days
> survprobs[pct==0.7]
[1] 18.01726 # 70% deaths at 18 days
This also works:
> (1-pct)[70]
[1] 0.3
> survprobs[(1-pct)==((1-pct)[70])]
[1] 18.01726
What is going on?