
G-Computation Risk-Ratio Inference for Binary Responses
Source:R/inference_incidence_gcomp.R
InferenceIncidGCompRiskRatio.RdFits a logistic working model, \(\mathrm{logit}\,\Pr(Y_i=1\mid x_i) =
x_i^\top\hat\beta\), for an incidence outcome using treatment and, optionally,
all recorded covariates, then estimates the marginal (standardized) risk
ratio \(\mathrm{RR} = \overline{\mathrm{risk}}_1 / \overline{\mathrm{risk}}_0\)
by G-computation: setting every subject's treatment indicator to 1
(respectively 0) while holding their other observed covariates fixed,
averaging the model-implied risk over the empirical covariate distribution
under each counterfactual, and taking the ratio — see
gcomp_logistic_point_estimate_cpp for the exact standardization
formula (mean1/mean0). Bootstrap/jackknife inference on this
estimand is generally done on the log risk-ratio scale internally
(see $compute_bootstrap_confidence_interval(),
$compute_bayesian_bootstrap_confidence_interval(), and the
jackknife-Wald methods, whose "basic"/"wald" interval types
route through log-scale-specific helpers for this estimand), then
back-transformed, since ratio estimators are typically closer to normally
distributed on the log scale. Inference is nonparametric-bootstrap/
randomization/jackknife-based (likelihood_tier = "none"): no
closed-form asymptotic standard error is used.
See also
InferenceIncidGCompRiskDiff
for the risk-difference version of this same standardized logistic working model.
Super class
Inference -> InferenceIncidGCompRiskRatio
Methods
Public methods
InferenceIncidGCompRiskRatio$approximate_bootstrap_distribution_beta_hat_T()InferenceIncidGCompRiskRatio$compute_bootstrap_confidence_interval()InferenceIncidGCompRiskRatio$compute_bootstrap_two_sided_pval()InferenceIncidGCompRiskRatio$compute_bayesian_bootstrap_two_sided_pval()InferenceIncidGCompRiskRatio$compute_bayesian_bootstrap_confidence_interval()InferenceIncidGCompRiskRatio$compute_jackknife_wald_two_sided_pval()InferenceIncidGCompRiskRatio$compute_jackknife_wald_confidence_interval()
+ inherited public methods from Inference
Inference$capabilities()Inference$compute_asymp_confidence_interval()Inference$compute_asymp_two_sided_pval()Inference$compute_estimate()Inference$compute_exact_confidence_interval()Inference$compute_exact_two_sided_pval_for_treatment_effect()Inference$duplicate()Inference$get_analysis_data()Inference$get_covariates()Inference$get_design_object()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_response()Inference$get_response_type()Inference$get_treatment()Inference$initialize()Inference$is_nonestimable()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
Examples
# \donttest{
seq_des = DesignSeqOneByOneBernoulli$new(n = 10, response_type = 'incidence')
for (i in 1:10) {
seq_des$add_one_subject_to_experiment_and_assign(data.frame(x1 = rnorm(1)))
}
seq_des$add_all_subject_responses(rbinom(10, 1, 0.5))
inf = InferenceIncidGCompRiskRatio$new(seq_des)
inf$compute_estimate()
#> [1] 0.9366012
# }