Hi,
I would like to fit parametric survival models to time-to-event data that are left truncated. I have checked the help page for survreg and looked in the R-help archive, and it appears that the R function survreg from the survival library (version 2.16) should allow me to take account of left truncation. However, when I try the command
summary(survreg(Surv(t,y,d,type="counting")~x2+x3,data=statadata0,dist="weibull",control=list(maxiter=100),na.action=na.exclude))
or
summary(survreg(Surv(t,y,d,type="counting")~x2+x3,data=statadata0,dist="lognormal",control=list(maxiter=100),na.action=na.exclude))
I get the following error message:
Error in survreg(Surv(t, y, d, type = "counting") ~ x2 + x3, data = statadata0, :
Invalid survival type
However, when I instead try fitting a Cox model (taking into account the left truncation) using coxph, i.e,
summary(coxph(Surv(t,y,d,type="counting")~x2+x3,data=statadata0,na.action=na.exclude))
it works:
>
Call:
coxph(formula = Surv(t, y, d, type = "counting") ~ x2 + x3, data = statadata0,
na.action = na.exclude)
n= 235 coef exp(coef) se(coef) z p x2 1.2957 3.65 0.2771 4.68 2.9e-06 x3 0.0936 1.10 0.0128 7.30 2.9e-13
exp(coef) exp(-coef) lower .95 upper .95 x2 3.65 0.274 2.12 6.29 x3 1.10 0.911 1.07 1.13
Rsquare= 0.322 (max possible= 0.961 ) Likelihood ratio test= 91.2 on 2 df, p=0 Wald test = 85.3 on 2 df, p=0 Score (logrank) test = 106 on 2 df, p=0
Am I doing something wrong or is there something wrong with survreg?
By the way, I have found a way to fit a Weibull model to left truncated data using weibreg from Göran Broström's library(eha):
>library(eha) >summary(weibreg(Surv(t,y,d,type="counting")~x2+x3,data=statadata0,na.action=na.exclude))
fit$fail = 0 Call: weibreg(formula = Surv(t, y, d, type = "counting") ~ x2 + x3, data = statadata0, na.action = na.exclude)
Covariate Mean Coef Rel.Risk L-R p Wald p x2 0.386 1.326 3.765 0.000 x3 21.076 0.095 1.100 0.000
log(scale) 0.000 3.216 24.919 0.000 log(shape) 0.000 1.134 3.109 0.000
Events 78 Total time at risk 2096.1 Max. log. likelihood -262.02 LR test statistic 93.5 Degrees of freedom 4 Overall p-value 0
but I am then only limited to fitting Weibull models. Also, what I really am interested in, at the moment, is fitting Weibull "frailty" models, which I can't do with weibreg, but would be able to do (I think?) with survreg if it did allow left truncation. (I know that Cox frailty models can be fitted. For example,
>summary(coxph(Surv(t,y,d,type="counting")~x2+x3+frailty(id),data=statadata0,na.action=na.exclude)) Call: coxph(formula = Surv(t, y, d, type = "counting") ~ x2 + x3 + frailty(id), data = statadata0, na.action = na.exclude)
n= 235 coef se(coef) se2 Chisq DF p x2 1.710 0.3395 0.2890 25.4 1.0 4.7e-07 x3 0.125 0.0191 0.0152 43.0 1.0 5.4e-11 frailty(id) 88.5 65.1 2.9e-02
exp(coef) exp(-coef) lower .95 upper .95 x2 5.53 0.181 2.84 10.76 x3 1.13 0.882 1.09 1.18
Iterations: 6 outer, 31 Newton-Raphson Variance of random effect= 1.23 I-likelihood = -328.2 Degrees of freedom for terms= 0.7 0.6 65.1 Rsquare= 0.625 (max possible= 0.961 ) Likelihood ratio test= 231 on 66.5 df, p=0 Wald test = 71.6 on 66.5 df, p=0.311
).
If anyone knows of a way to fix survreg so that it allows left truncation, I would be most appreciated to hear from you.
All the best,
Brian
______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html