dr_rml: Fit the DR-RML model

View source: R/dr_rml.R

dr_rmlR Documentation

Fit the DR-RML model

Description

Estimate double-robust average causal effect for restricted mean lifetime.

Usage

dr_rml(
  Y,
  Censor,
  A,
  Xps,
  Xreg,
  L,
  PS = c("logit", "logit2", "SL", "GBM"),
  Reg = c("lm", "lm2", "SL"),
  nboot
)

Arguments

Y:

event time.

Censor:

censoring indicator, 1: observed; 0: right-censored.

A:

binary treatment indicator 1: treated; 0: untreated.

Xps:

baseline covariate for fitting propensity score model of A=1.

Xreg:

baseline covariate for fitting outcome regression model.

L:

a scalar value to truncate the timepoint for RML, L < max(Y).

PS:

specify the propensity score model from one of following options:

  • logit: parametric logistic regression.

  • logit2: improved parametric logistic regression (Cao et al., 2009).

  • SL: super learner (package: SuperLearner) with libraries SL.glm, SL.glm.interaction, SL.step.

  • GBM: Generalized boosted model (package: gbm).

Reg:

specify the outcome regression model from one of follwoing options:

  • lm: parametric gaussian regression.

  • lm2: improved parametric gaussian regression (Cao et al., 2009).

  • SL: super learner (package: SuperLearner) with libraries SL.glm, SL.glm.interaction, SL.step.

nboot:

a numeric value to specify the number of bootstrap for standard error of ACE. If standard error estiamtes is unnecessary, use nboot = 0.

Details

see Choi et al., (2022+) for detailed method explanation.

Value

dr_RML returns a list containing at least the following components:

  • mu1: average effect for treated group.

  • mu0: average effect for untreated group.

  • ace: average causal effect mu1 - mu0.

  • se: standard error estimates for ace.

References

Cao, W., Tsiatis, A. A., & Davidian, M. (2009). Improving efficiency and robustness of the doubly robust estimator for a population mean with incomplete data. Biometrika, 96(3), 723–734.

Choi, S., Choi, T., Lee, H-Y., Han, S. W., Bandyopadhyay, D. (2022+). Double-robust methods for estimating differences in restricted mean lifetimes using pseudo-observations. In revision, Pharmaceutical Statistics.

Examples

## Not run: 
simdata = function(n, tau) {
  require(mvtnorm)
  expit = function(x) exp(x) / (1 + exp(x))
  Sigma = diag(rep(1, 3))
  Sigma[1, 3] = Sigma[3, 1] = 0.2
  Z = rmvnorm(n,
              mean = rep(0, 3),
              sigma = Sigma,
              method = "chol")
  Z1 = Z[, 1]
  Z2 = Z[, 2]
  Z3 = Z[, 3]
  # trt indicator (Bernoulli)
  A = rbinom(n, 1, expit(-0.5 * Z1 - 0.5 * Z2))# Z1 and Z2 are involved in trt assignment
  par.t = exp((-2.5 - 1.5 * Z1 - 1 * Z2 - 0.7 * Z3) * (A == 0) +
                (-3 - 1 * Z1 - 0.9 * Z2 - 1 * Z3) * (A == 1))
  T = rexp(n, par.t)                   # true survival time
  C = rexp(n, tau)                     # independent censoring
  # tau as a controller of censoring rate
  Y = pmin(T, C)                       # observed time
  delta = ifelse(T <= C, 1, 0)         # censoring indicator
  simdata = data.frame(Y = round(Y, 5), delta, A, Z1, Z2, Z3, T)
  simdata[order(Y), ]
}
L = 10       
n = 600      
tau = exp(-4.5)
truepar = ifelse(L == 10, 0.871, 1.682)

set.seed(123)
dt = simdata(n, tau)
Y = dt$Y
Censor = dt$delta
A = dt$A

X = dt[, 4:6]
dr_rml(Y = Y, Censor = Censor, A = A, Xps = X, Xreg = X,
       L = L, PS = "logit", Reg = "lm", nboot = 10)$ace

# Data Application
data(gse)
Y = gse$Y
Censor = gse$Censor
A = gse$trt
X = gse[, 3:6]
L = 365 * 5
dr_rml(Y = Y, Censor = Censor, A = A, Xps = X, Xreg = X,
       L = L, PS = "logit", Reg = "lm", nboot = 10)

library(tmle)
library(pseudo)
prmst = pseudomean(Y, Censor, L)
Xt = cova = as.data.frame(model.matrix( ~ -1 + Age + Size + Grade + Er, data = gse))
fit = tmle(
  Y = prmst, A = A, W = cova,
  Q.SL.library = c("SL.glm", "SL.glm.interaction", "SL.step"),
  g.SL.library =  c("SL.glm", "SL.glm.interaction", "SL.step")
)
# Other methods
tmsl = fit$estimates$ATE$psi
library(grf)
cffit = causal_forest(Xt, prmst, A)
cf = mean(cffit$predictions)

## End(Not run)

taehwa015/drRML documentation built on Aug. 28, 2023, 8:48 p.m.