Simple and fast version for IPCW regression for just one time-point thus fitting the model
$$E( min(T, t) | X ) = exp( X^T beta) $$ or in the case of competing risks data
$$E( I(epsilon=1) (t - min(T ,t)) | X ) = exp( X^T beta) $$ thus given years lost to
cause, see binreg
for the arguments.
resmeanIPCW(formula, data, ...)
When the status is binary assumes it is a survival setting and default is to consider outcome Y=min(T,t), if status has more than two levels, then computes years lost due to the specified cause, thus using the response $$ Y = (t-min(T,t)) I(status=cause) $$
Based on binomial regresion IPCW response estimating equation: $$ X ( \Delta(min(T,t)) Y /G_c(min(T,t)) - exp( X^T beta)) = 0 $$ for IPCW adjusted responses. Here $$ \Delta(min(T,t)) = I ( min(T ,t) \leq C ) $$ is indicator of being uncensored. Concretely, the uncensored observations at time t will count those with an event (of any type) before t and those with a censoring time at t or further out. One should therefore be a bit careful when data has been constructed such that some of the event times T are equivalent to t.
Can also solve the binomial regresion IPCW response estimating equation: $$ h(X) X ( \Delta(min(T,t)) Y /G_c(min(T,t)) - exp( X^T beta)) = 0 $$ for IPCW adjusted responses where $h$ is given as an argument together with iid of censoring with h.
By using appropriately the h argument we can also do the efficient IPCW estimator estimator.
Variance is based on $$ \sum w_i^2 $$ also with IPCW adjustment, and naive.var is variance under known censoring model.
When Ydirect is given it solves : $$ X ( \Delta(min(T,t)) Ydirect /G_c(min(T,t)) - exp( X^T beta)) = 0 $$ for IPCW adjusted responses.
The actual influence (type="II") function is based on augmenting with $$ X \int_0^t E(Y | T>s) /G_c(s) dM_c(s) $$ and alternatively just solved directly (type="I") without any additional terms.
Censoring model may depend on strata.
data(bmt); bmt$time <- bmt$time+runif(nrow(bmt))*0.001
# E( min(T;t) | X ) = exp( a+b X) with IPCW estimation
out <- resmeanIPCW(Event(time,cause!=0)~tcell+platelet+age,bmt,
time=50,cens.model=~strata(platelet),model="exp")
summary(out)
#>
#> n events
#> 408 245
#>
#> 408 clusters
#> coeffients:
#> Estimate Std.Err 2.5% 97.5% P-value
#> (Intercept) 3.014390 0.065113 2.886771 3.142009 0.0000
#> tcell 0.106356 0.138332 -0.164770 0.377483 0.4420
#> platelet 0.246773 0.097354 0.055963 0.437584 0.0113
#> age -0.185967 0.043572 -0.271366 -0.100567 0.0000
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> (Intercept) 20.37666 17.93530 23.1503
#> tcell 1.11222 0.84809 1.4586
#> platelet 1.27989 1.05756 1.5490
#> age 0.83030 0.76234 0.9043
#>
#>
### same as Kaplan-Meier for full censoring model
bmt$int <- with(bmt,strata(tcell,platelet))
out <- resmeanIPCW(Event(time,cause!=0)~-1+int,bmt,time=30,
cens.model=~strata(platelet,tcell),model="lin")
estimate(out)
#> Estimate Std.Err 2.5% 97.5% P-value
#> inttcell=0, platelet=0 13.60 0.8316 11.97 15.23 3.828e-60
#> inttcell=0, platelet=1 18.90 1.2696 16.41 21.39 3.995e-50
#> inttcell=1, platelet=0 16.19 2.4061 11.48 20.91 1.705e-11
#> inttcell=1, platelet=1 17.77 2.4536 12.96 22.58 4.465e-13
out1 <- phreg(Surv(time,cause!=0)~strata(tcell,platelet),data=bmt)
rm1 <- resmean.phreg(out1,times=30)
summary(rm1)
#> strata times rmean se.rmean years.lost
#> tcell=0, platelet=0 0 30 13.60293 0.8315429 16.39707
#> tcell=0, platelet=1 1 30 18.90109 1.2693125 11.09891
#> tcell=1, platelet=0 2 30 16.19119 2.4006231 13.80881
#> tcell=1, platelet=1 3 30 17.76605 2.4422115 12.23395
## competing risks years-lost for cause 1
out <- resmeanIPCW(Event(time,cause)~-1+int,bmt,time=30,cause=1,
cens.model=~strata(platelet,tcell),model="lin")
estimate(out)
#> Estimate Std.Err 2.5% 97.5% P-value
#> inttcell=0, platelet=0 12.105 0.8508 10.438 13.773 6.162e-46
#> inttcell=0, platelet=1 6.884 1.1741 4.583 9.186 4.530e-09
#> inttcell=1, platelet=0 7.261 2.3533 2.648 11.873 2.033e-03
#> inttcell=1, platelet=1 5.780 2.0925 1.679 9.882 5.737e-03
## same as integrated cumulative incidence
rmc1 <- cif.yearslost(Event(time,cause)~strata(tcell,platelet),data=bmt,times=30)
summary(rmc1)
#> strata times intF11 intF12 se.intF11 se.intF12
#> tcell=0, platelet=0 0 30 12.105147 4.291922 0.8508116 0.6161435
#> tcell=0, platelet=1 1 30 6.884355 4.214555 1.1740897 0.9057043
#> tcell=1, platelet=0 2 30 7.260775 6.548038 2.3532930 1.9703353
#> tcell=1, platelet=1 3 30 5.780418 6.453529 2.0925144 2.0815222
#> total.years.lost
#> tcell=0, platelet=0 16.39707
#> tcell=0, platelet=1 11.09891
#> tcell=1, platelet=0 13.80881
#> tcell=1, platelet=1 12.23395