The binreg function does direct binomial regression for one time-point, t, fitting the model the estimation is based on IPCW weighted EE for IPCW adjusted responses and with Δ indicator of death and Gc censoring survival distribution. With Δ(t) = I(Ci > Ti ∧ t).
The function logitIPCW instead considers The two score equations are quite similar, and exactly the same when the censoring model is fully-nonparametric.
Additional functions logitATE, and binregATE computes the average treatment effect, the average effect on treated (ATT), and the average effect on non-treated (ATC). We demonstrate this in another vignette.
The function logitATE also works when there is no censoring and we thus have simple binary outcome.
Variance is based on sandwich formula with IPCW adjustment, and naive.var is variance under known censoring model. The influence functions are stored in the output.
library(mets)
options(warn=-1)
set.seed(1000) # to control output in simulatins for p-values below.
data(bmt)
bmt$time <- bmt$time+runif(nrow(bmt))*0.01
# logistic regresion with IPCW binomial regression
out <- binreg(Event(time,cause)~tcell+platelet,bmt,time=50)
summary(out)
#>
#> n events
#> 408 160
#>
#> 408 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -0.178126 0.127204 -0.427442 0.071189 0.1614
#> tcell -0.426691 0.348043 -1.108843 0.255460 0.2202
#> platelet -0.441989 0.242406 -0.917095 0.033117 0.0683
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 0.83684 0.65218 1.0738
#> tcell 0.65266 0.32994 1.2911
#> platelet 0.64276 0.39968 1.0337
We can also compute predictions using the estimates
predict(out,data.frame(tcell=c(0,1),platelet=c(1,1)),se=TRUE)
#> pred se lower upper
#> 1 0.3497553 0.04858060 0.2545373 0.4449732
#> 2 0.2598388 0.07039666 0.1218613 0.3978162
Further the censoring model can depend on strata
outs <- binreg(Event(time,cause)~tcell+platelet,bmt,time=50,cens.model=~strata(tcell,platelet))
summary(outs)
#>
#> n events
#> 408 160
#>
#> 408 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -0.180697 0.127414 -0.430424 0.069030 0.1561
#> tcell -0.365928 0.350632 -1.053154 0.321299 0.2967
#> platelet -0.433494 0.240270 -0.904415 0.037428 0.0712
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 0.83469 0.65023 1.0715
#> tcell 0.69355 0.34884 1.3789
#> platelet 0.64824 0.40478 1.0381
Now for illustrations I wish to consider the absolute risk difference depending on tcell
outs <- binreg(Event(time,cause)~tcell,bmt,time=50,cens.model=~strata(tcell))
summary(outs)
#>
#> n events
#> 408 160
#>
#> 408 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -0.30054 0.11153 -0.51914 -0.08194 0.0070
#> tcell -0.51741 0.33981 -1.18342 0.14860 0.1278
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 0.74042 0.59503 0.9213
#> tcell 0.59606 0.30623 1.1602
the risk difference is
ps <- predict(outs,data.frame(tcell=c(0,1)),se=TRUE)
ps
#> pred se lower upper
#> 1 0.4254253 0.02726306 0.3719897 0.4788609
#> 2 0.3061988 0.06819019 0.1725461 0.4398516
sum( c(1,-1) * ps[,1])
#> [1] 0.1192264
Getting the standard errors are easy enough since the two-groups are independent. In the case where we in addition had adjusted for other covariates, however, we would need the to apply the delta-theorem thus using the relevant covariances along the lines of
dd <- data.frame(tcell=c(0,1))
p <- predict(outs,dd)
riskdifratio <- function(p,contrast=c(1,-1)) {
outs$coef <- p
p <- predict(outs,dd)[,1]
pd <- sum(contrast*p)
r1 <- p[1]/p[2]
r2 <- p[2]/p[1]
return(c(pd,r1,r2))
}
estimate(outs,f=riskdifratio,dd,null=c(0,1,1))
#> Estimate Std.Err 2.5% 97.5% P-value
#> [p1] 0.1192 0.07344 -0.02471 0.2632 0.10448
#> [p2] 1.3894 0.32197 0.75833 2.0204 0.22652
#> [p3] 0.7197 0.16679 0.39284 1.0467 0.09291
#>
#> Null Hypothesis:
#> [p1] = 0
#> [p2] = 1
#> [p3] = 1
#>
#> chisq = 12.0249, df = 3, p-value = 0.007298
same as
Rather than using a larger censoring model we can also compute an augmentation term and then fit the binomial regression model based on this augmentation term. Here we compute the augmentation based on stratified non-parametric estimates of F1(t, S(X)), where S(X) gives strata based on X as a working model.
Computes the augmentation term for each individual as well as the sum with using a KM for Gc(t) and a working model for cumulative baseline related to F1*(t, s) and s is strata, S*(t, s) = 1 − F1*(t, s) − F2*(t, s).
Standard errors computed under assumption of correct but estimated Gc(s) model.
data(bmt)
dcut(bmt,breaks=2) <- ~age
out1<-BinAugmentCifstrata(Event(time,cause)~platelet+agecat.2+
strata(platelet,agecat.2),data=bmt,cause=1,time=40)
summary(out1)
#>
#> n events
#> 408 157
#>
#> 408 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -0.50047 0.17043 -0.83450 -0.16643 0.0033
#> platelet -0.63482 0.23584 -1.09706 -0.17258 0.0071
#> agecat.2(0.203,1.94] 0.53812 0.21185 0.12291 0.95333 0.0111
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 0.60625 0.43409 0.8467
#> platelet 0.53003 0.33385 0.8415
#> agecat.2(0.203,1.94] 1.71279 1.13078 2.5943
out2<-BinAugmentCifstrata(Event(time,cause)~platelet+agecat.2+
strata(platelet,agecat.2)+strataC(platelet),data=bmt,cause=1,time=40)
summary(out2)
#>
#> n events
#> 408 157
#>
#> 408 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) -0.49984 0.17054 -0.83409 -0.16559 0.0034
#> platelet -0.63650 0.23627 -1.09958 -0.17342 0.0071
#> agecat.2(0.203,1.94] 0.53709 0.21190 0.12177 0.95242 0.0113
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 0.60663 0.43427 0.8474
#> platelet 0.52914 0.33301 0.8408
#> agecat.2(0.203,1.94] 1.71103 1.12949 2.5920
sessionInfo()
#> R version 4.4.2 (2024-10-31)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.1 LTS
#>
#> Matrix products: default
#> BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
#> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
#> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
#> [9] LC_ADDRESS=C LC_TELEPHONE=C
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] mets_1.3.4 timereg_2.0.6 survival_3.7-0 rmarkdown_2.29
#>
#> loaded via a namespace (and not attached):
#> [1] cli_3.6.3 knitr_1.49 rlang_1.1.4
#> [4] xfun_0.49 jsonlite_1.8.9 listenv_0.9.1
#> [7] future.apply_1.11.3 buildtools_1.0.0 lava_1.8.0
#> [10] htmltools_0.5.8.1 maketools_1.3.1 sys_3.4.3
#> [13] sass_0.4.9 grid_4.4.2 evaluate_1.0.1
#> [16] jquerylib_0.1.4 fastmap_1.2.0 mvtnorm_1.3-2
#> [19] yaml_2.3.10 lifecycle_1.0.4 numDeriv_2016.8-1.1
#> [22] compiler_4.4.2 codetools_0.2-20 ucminf_1.2.2
#> [25] Rcpp_1.0.13-1 future_1.34.0 lattice_0.22-6
#> [28] digest_0.6.37 R6_2.5.1 parallelly_1.39.0
#> [31] parallel_4.4.2 splines_4.4.2 bslib_0.8.0
#> [34] Matrix_1.7-1 tools_4.4.2 globals_0.16.3
#> [37] cachem_1.1.0