Quantile treatment effects, marginal over the empirical covariate distribution
qte.causalmixgpd_causal_fit.Rdqte() returns the marginal quantile treatment effect implied by the
causal fit.
Usage
# S3 method for class 'causalmixgpd_causal_fit'
qte(
fit,
probs = c(0.1, 0.5, 0.9),
newdata = NULL,
y = NULL,
interval = "credible",
level = 0.95,
show_progress = TRUE
)Arguments
- fit
A
"causalmixgpd_causal_fit"object fromrun_mcmc_causal().- probs
Numeric vector of probabilities in (0, 1) specifying the quantile levels of the outcome distribution to estimate treatment effects at.
- newdata
Ignored for marginal estimands. If supplied, a warning is issued and training data are used.
- y
Ignored for marginal estimands. If supplied, a warning is issued and training data are used.
- interval
Character or NULL; type of credible interval:
NULL: no interval"credible"(default): equal-tailed quantile intervals"hpd": highest posterior density intervals
- level
Numeric credible level for intervals (default 0.95 for 95 percent CI).
- show_progress
Logical; if TRUE, print step messages and render progress where supported.
Value
An object of class "causalmixgpd_qte" containing the
marginal QTE summary, the probability grid, and the arm-specific predictive
objects used in the aggregation. The returned object includes a top-level
$fit_df data frame for direct extraction.
Details
The package computes $$\mathrm{QTE}(\tau) = Q_1^{m}(\tau) - Q_0^{m}(\tau),$$ where \(Q_a^{m}(\tau)\) is the arm-\(a\) posterior predictive marginal quantile obtained by averaging over the empirical training covariate distribution.
For unconditional causal models (X = NULL), this reduces to a direct
contrast of the arm-level unconditional predictive distributions.
Examples
# \donttest{
N <- 25
X <- data.frame(x1 = stats::rnorm(N))
A <- stats::rbinom(N, 1, 0.5)
y <- abs(stats::rnorm(N)) + 0.1
mcmc_small <- list(niter = 100, nburnin = 50, thin = 1, nchains = 1, seed = 1)
cb <- build_causal_bundle(y = y, X = X, A = A, backend = "sb", kernel = "normal",
components = 3, mcmc_outcome = mcmc_small, mcmc_ps = mcmc_small)
fit <- run_mcmc_causal(cb, show_progress = FALSE)
#> Defining model
#> Building model
#> Setting data and initial values
#> Checking model sizes and dimensions
#> [Note] This model is not fully initialized. This is not an error.
#> To see which variables are not initialized, use model$initializeInfo().
#> For more information on model initialization, see help(modelInitialization).
#> ===== Monitors =====
#> thin = 1: beta
#> ===== Samplers =====
#> RW sampler (2)
#> - beta[] (2 elements)
#> Compiling
#> [Note] This may take a minute.
#> [Note] Use 'showCompilerOutput = TRUE' to see C++ compilation details.
#> Compiling
#> [Note] This may take a minute.
#> [Note] Use 'showCompilerOutput = TRUE' to see C++ compilation details.
#> running chain 1...
#> Defining model
#> Building model
#> Setting data and initial values
#> Checking model sizes and dimensions
#> [Note] This model is not fully initialized. This is not an error.
#> To see which variables are not initialized, use model$initializeInfo().
#> For more information on model initialization, see help(modelInitialization).
#> ===== Monitors =====
#> thin = 1: alpha, beta_mean, beta_ps_mean, sd, w
#> ===== Samplers =====
#> conjugate sampler (3)
#> - sd[] (3 elements)
#> categorical sampler (12)
#> - z[] (12 elements)
#> RW sampler (9)
#> - alpha
#> - beta_mean[] (3 elements)
#> - beta_ps_mean[] (3 elements)
#> - v[] (2 elements)
#> [Note] Assigning an RW_block sampler to nodes with very different scales can result in low MCMC efficiency. If all nodes assigned to RW_block are not on a similar scale, we recommend providing an informed value for the "propCov" control list argument, or using the "barker" sampler instead.
#> Compiling
#> [Note] This may take a minute.
#> [Note] Use 'showCompilerOutput = TRUE' to see C++ compilation details.
#> Compiling
#> [Note] This may take a minute.
#> [Note] Use 'showCompilerOutput = TRUE' to see C++ compilation details.
#> [Warning] To calculate WAIC, set 'WAIC = TRUE', in addition to having enabled WAIC in building the MCMC.
#> running chain 1...
#> Defining model
#> Building model
#> Setting data and initial values
#> Checking model sizes and dimensions
#> [Note] This model is not fully initialized. This is not an error.
#> To see which variables are not initialized, use model$initializeInfo().
#> For more information on model initialization, see help(modelInitialization).
#> ===== Monitors =====
#> thin = 1: alpha, beta_mean, beta_ps_mean, sd, w
#> ===== Samplers =====
#> conjugate sampler (3)
#> - sd[] (3 elements)
#> categorical sampler (13)
#> - z[] (13 elements)
#> RW sampler (9)
#> - alpha
#> - beta_mean[] (3 elements)
#> - beta_ps_mean[] (3 elements)
#> - v[] (2 elements)
#> [Note] Assigning an RW_block sampler to nodes with very different scales can result in low MCMC efficiency. If all nodes assigned to RW_block are not on a similar scale, we recommend providing an informed value for the "propCov" control list argument, or using the "barker" sampler instead.
#> Compiling
#> [Note] This may take a minute.
#> [Note] Use 'showCompilerOutput = TRUE' to see C++ compilation details.
#> Compiling
#> [Note] This may take a minute.
#> [Note] Use 'showCompilerOutput = TRUE' to see C++ compilation details.
#> [Warning] To calculate WAIC, set 'WAIC = TRUE', in addition to having enabled WAIC in building the MCMC.
#> running chain 1...
qte(fit, probs = c(0.5, 0.9))
#> [qte] Preparing QTE inputs
#> [qte] Preparing propensity-score adjustment
#> [qte] Predicting treated-arm draws
#> [qte] Predicting control-arm draws
#> [qte] Aggregating QTE estimates
#> QTE (Quantile Treatment Effect)
#> Prediction points: 1
#> Quantile grid: 0.5, 0.9
#> Conditional (covariates): NO
#> Propensity score used: YES
#> PS scale: logit
#> Credible interval: credible (95%)
#>
#> QTE estimates (treated - control):
#> index mean lower upper
#> 0.5 -0.044 -2.085 1.164
#> 0.9 1.404 -1.744 7.604
# }