
Internal base for user-defined randomization inference extensions
Source:R/inference_custom_extensions.R
InferenceCustomRand.RdThis class uses the same fit() result contract as
InferenceCustomAsymp, but only promises estimate/randomization/
randomization-CI behavior.
Super class
Inference -> InferenceCustomRand
Methods
+ inherited public methods from Inference
Inference$capabilities()Inference$clear_randomization_cache()Inference$compute_asymp_confidence_interval()Inference$compute_asymp_two_sided_pval()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_estimand()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_procedure_validity()Inference$get_response()Inference$get_response_type()Inference$get_summary()Inference$get_supported_estimands()Inference$get_treatment()Inference$initialize()Inference$is_nonestimable()Inference$set_estimand()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
InferenceCustomRand$compute_rand_two_sided_pval()
Computes a randomization two-sided p-value. Delegates to the `RandomizationCI`-provided dispatch (Zhang incidence support, type/args_for_type) since `RandomizationCI` pulls in `RandomizationTest`, and the two provide conflicting `compute_rand_two_sided_pval` implementations – the same conflict `InferenceCustomAsymp` and `InferenceCustomBoot` resolve the same way.
Usage
InferenceCustomRand$compute_rand_two_sided_pval(
r = 501,
delta = 0,
transform_responses = "none",
na.rm = TRUE,
show_progress = TRUE,
permutations = NULL,
type = NULL,
args_for_type = NULL,
zero_one_logit_clamp = .Machine$double.eps,
alternative = "two.sided"
)Arguments
rNumber of randomization vectors.
deltaNull treatment effect value.
transform_responsesResponse transformation to apply during the test. For survival responses the default
"log"multiplies the recorded times of the units treated under each reference allocation by \(e^\delta\), event and censoring times alike, with censoring indicators unchanged – the rank-based AFT residual construction (Tsiatis 1990; Wei, Ying and Lin 1990; Jin, Lin, Wei and Ying 2003); seecompute_rand_confidence_interval()for the assumptions.na.rmWhether to remove non-finite simulated statistics.
show_progressWhether to show progress.
permutationsOptional pre-generated assignment draws.
typeNULL(default) or"Zhang", the only accepted value.NULLcomputes the p-value from the randomization draws."Zhang"instead returns the Zhang exact combined test (seeInferenceIncidExactZhang); it applies only to incidence responses on a Bernoulli or matching design. For any other response or design, a non-NULLtypeis an error; other strings (for example"Fisher"or"exact") are rejected.args_for_typeNULLor a list keyed bytype, used only withtype = "Zhang":list(Zhang = list(combination_method = "Stouffer")), wherecombination_methodis"Fisher"(default),"Stouffer"or"min_p".zero_one_logit_clampThe clamping amount for exact 0 and 1 values when logging
alternative"two.sided"(default),"greater"or"less"; use"greater"for a non-negative, one-tailed-by-construction statistic. The observed allocation counts as one of the \(B\) finite draws: two-sided is \(\min(1, 2(1 + \min(b_{\ge}, b_{\le}))/(1 + B))\) (doubled smaller tail, smallest value \(2/(B + 1)\));"greater"is \((1 + b_{\ge})/(1 + B)\) (smallest \(1/(B + 1)\)), where \(b_{\ge}\) and \(b_{\le}\) count the draws at least as large / as small as the observed statistic. This exact Monte Carlo p-value (Phipson and Smyth 2010) has size at most \(\alpha\) and is never 0; the realized allocation is never counted twice (a seeded design's replay of it is skipped, a full enumeration's copy removed); seeInferenceRand$compute_rand_two_sided_pval().
InferenceCustomRand$fit()
Calls the user-defined fit callback for this custom inference path; see
InferenceCustomAsymp.
InferenceCustomRand$compute_estimate()
Compute the treatment-effect estimate by delegating to the
user-supplied custom estimator (the $fit() callback). See
InferenceRand.