Create simple life table
# S3 method for matrix
lifetable(x, strata = list(), breaks = c(),
weights=NULL, confint = FALSE, ...)
# S3 method for formula
lifetable(x, data=parent.frame(), breaks = c(),
weights=NULL, confint = FALSE, ...)
time formula (Surv) or matrix/data.frame with columns time,status or entry,exit,status
strata
time intervals
weights variable
if TRUE 95% confidence limits are calculated
additional arguments to lower level functions
data.frame
library(timereg)
data(TRACE)
d <- with(TRACE,lifetable(Surv(time,status==9)~sex+vf,breaks=c(0,0.2,0.5,8.5)))
summary(glm(events ~ offset(log(atrisk))+factor(int.end)*vf + sex*vf,
data=d,poisson))
#>
#> Call:
#> glm(formula = events ~ offset(log(atrisk)) + factor(int.end) *
#> vf + sex * vf, family = poisson, data = d)
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -0.444337 0.088565 -5.017 5.25e-07 ***
#> factor(int.end)0.5 -1.197746 0.137896 -8.686 < 2e-16 ***
#> factor(int.end)8.5 -1.871838 0.085480 -21.898 < 2e-16 ***
#> vf 1.830440 0.212178 8.627 < 2e-16 ***
#> sex -0.239036 0.071749 -3.332 0.000864 ***
#> factor(int.end)0.5:vf -1.746744 0.534757 -3.266 0.001089 **
#> factor(int.end)8.5:vf -1.927748 0.244888 -7.872 3.49e-15 ***
#> vf:sex 0.009668 0.230970 0.042 0.966613
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> (Dispersion parameter for poisson family taken to be 1)
#>
#> Null deviance: 653.5540 on 11 degrees of freedom
#> Residual deviance: 1.1523 on 4 degrees of freedom
#> AIC: 79.938
#>
#> Number of Fisher Scoring iterations: 4
#>