Fits Cox model with treatment weights $$ w(A)= \sum_a I(A=a)/\pi(a|X)$$, where $$\pi(a|X)=P(A=a|X)$$. Computes standard errors via influence functions that are returned as the IID argument. Propensity scores are fitted using either logistic regression (glm) or the multinomial model (mlogit) when there are than treatment categories. The treatment needs to be a factor and is identified on the rhs of the "treat.model". Recurrent events can be considered with start,stop structure and then cluster(id) must be specified. Robust standard errors are computed in all cases.
phreg_IPTW(
formula,
data,
treat.model = NULL,
treat.var = NULL,
weights = NULL,
estpr = 1,
pi0 = 0.5,
se.cluster = NULL,
...
)
for phreg
data frame for risk averaging
propensity score model (binary or multinomial)
a 1/0 variable that indicates when treatment is given and the propensity score is computed
may be given, and then uses weights*w(A) as the weights
(=1, default) to estimate propensity scores and get infuence function contribution to uncertainty
fixed simple weights
to compute GEE type standard errors when additional cluster structure is present
arguments for phreg call
Time-dependent propensity score weights can also be computed when treat.var is used, it must be 1 at the time of first (A_0) and 2nd treatment (A_1), then uses weights $$w_0(A_0) * w_1(A_1)^{t>T_r}$$ where $$T_r$$ is time of 2nd randomization.
library(mets)
data <- mets:::simLT(0.7,100,beta=0.3,betac=0,ce=1,betao=0.3)
dfactor(data) <- Z.f~Z
out <- phreg_IPTW(Surv(time,status)~Z.f,data=data,treat.model=Z.f~X)
summary(out)
#>
#> n events
#> 100 48
#>
#> 100 clusters
#> coeffients:
#> Estimate S.E. dU^-1/2 P-value
#> Z.f1 -0.21347 0.24567 0.20689 0.3849
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> Z.f1 0.80778 0.49909 1.3074
#>
#>