An abstract R6 Class that estimates, tests and provides intervals for a
treatment effect in a completed design.
This class takes a completed Design object as an input where this object
contains data for a fully completed experiment (i.e. all treatment
assignments were allocated and all responses were collected).
Active bindings
num_coresCurrent number of cores for this inference object. Defaults to the global budget unless overridden on the object.
Methods
Inference$new()
Initialize an estimation and test object after the design is completed.
Usage
Inference$new(
des_obj,
verbose = FALSE,
harden = TRUE,
model_formula = NULL,
smart_cold_start_default = NULL,
seed = NULL
)Arguments
des_objA completed
Designobject whose entire n subjects are assigned and response y is recorded within.verboseWhether to print progress messages.
hardenWhether to apply robustness measures (default
TRUE). WhenTRUE, the inference methods employ defensive strategies including QR-based rank reduction of the design matrix, progressive correlation-threshold dropping, and fallback fits (e.g.\ robust survival regression, treatment-only models) to avoid crashes on ill-conditioned data. WhenFALSE, the vanilla algorithm runs on the full design matrix as supplied; any rank deficiency or convergence failure will surface as an error rather than being silently worked around. Set toFALSEwhen you want to verify that the raw model converges without intervention.model_formulaOptional formula for covariate adjustment. If
NULL(default), the formula from the design object is used and its pre-computed design matrix is reused. If a formula is provided, a new design matrix is constructed from the design's imputed covariates.smart_cold_start_defaultWhether to use smart cold start values by default for likelihood-based models. Explicit starts always override this object-level policy.
NULL(default) consults the global cold-start dispatch policy.seedInteger seed for reproducibility.
Inference$capabilities()
Returns the effective metadata-backed capabilities for this inference object.
Inference$compute_exact_two_sided_pval_for_treatment_effect()
Computes an exact two-sided p-value. Subclasses that support exact inference override this; inference objects that do not support exact methods throw an error.
Inference$compute_exact_confidence_interval()
Computes an exact confidence interval. Subclasses that support exact inference override this; inference objects that do not support exact methods throw an error.
Inference$compute_asymp_two_sided_pval()
Computes an asymptotic two-sided p-value. Subclasses that support asymptotic inference override this; inference objects that do not support asymptotic methods throw an error.
Inference$compute_asymp_confidence_interval()
Computes an asymptotic confidence interval. Subclasses that support asymptotic inference override this; inference objects that do not support asymptotic methods throw an error.
Inference$compute_estimate()
Computes the treatment-effect estimate. Concrete subclasses implement the model-specific estimator, such as a fitted regression coefficient, maximum-likelihood parameter, estimating-equation solution, mean or risk contrast, survival contrast, or rank statistic. Interval, p-value, bootstrap, jackknife, and randomization methods use this method as the canonical point-estimate contract.
Inference$is_nonestimable()
Returns whether the most recent inference attempt explicitly marked the result as non-estimable.
Usage
Inference$is_nonestimable(type = c("any", "estimate", "se"))Inference$get_nonestimable_reason()
Returns the reason recorded for the most recent explicit non-estimability.
Inference$get_nonestimable_stage()
Returns the stage recorded for the most recent explicit non-estimability.
Inference$duplicate()
Duplicate this inference object
Inference$get_response()
Return the response vector used by inference extension classes.
This accessor is part of the supported extension contract for user-defined R6 inference classes. Prefer this method over direct access to private fields.
Inference$get_treatment()
Return the treatment-assignment vector used by inference extension classes.
This accessor is part of the supported extension contract for user-defined R6 inference classes. Treatment is encoded as 0/1.
Inference$get_covariates()
Return the processed covariate matrix used by inference extension classes.
This accessor returns the design object's model-matrix covariates, after
the package's missingness handling and encoding. It may be NULL if
no covariates are available.
Inference$get_analysis_data()
Return a data frame with response, treatment, censoring status, and covariates.
This accessor is the preferred data interface for user-defined R6
inference classes. It avoids reliance on private implementation fields.
The returned data frame always contains y, w, and
dead; covariate columns are appended when available.
Inference$get_design_object()
Return the completed design object backing this inference object.
This accessor is part of the supported extension contract. Extension
classes should use this method instead of private$des_obj.
Inference$set_optimization_alg()
Set the optimizer used by likelihood-based inference implementations.
Usage
Inference$set_optimization_alg(
optimization_alg = NULL,
allow_irls = private$optimization_alg_allow_irls,
default = private$optimization_alg_default
)Inference$get_optimization_alg()
Return the optimizer used by likelihood-based inference implementations.
