Skip to contents

A lightweight coordinator (not itself an Inference subclass, and not part of the Inference R6 hierarchy) that pairs a single completed Design object with the full set of concrete Inference classes compatible with it. On construction, the suite consults package-level inference metadata to discover every exported, non-abstract Inference subclass whose declared response-type, matched-design (KK), blocking, and censoring requirements are all satisfied by des_obj, storing the resulting sorted class-name vector in applicable_design_classes. Because discovery is driven by metadata lookups rather than by actually attempting to construct each candidate class, the applicable list automatically stays current as new inference classes are registered elsewhere in the package, without this class needing any changes, and without risking side effects (e.g. an optional-package load failure inside some class's constructor) from a doomed construction attempt.

Compatibility rules (the same rules Design's own applicable_inference_class_names() applies, so des_obj$applicable_inference_class_names() returns the same list, and des_obj$incompatible_inference_classes_due_to_design_structure() says why a class is missing): a candidate class is excluded if its name contains "IVWC" (the legacy KK estimators, superseded by their OneLik variants); if it is abstract or not exported; if it declares no compatible response types, or none match des_obj's response type; if its registered requires_kk_matching_design metadata is TRUE (a matched-design-only class) but des_obj does not support KK matching; if the class requires a blocking design (currently only InferenceIncidExtendedRobins – InferenceIncidCMH works on both blocking and non-blocking designs via different standard-error estimators, so it is not excluded) but des_obj does not support blocking; or if des_obj has any left-/interval-censored subjects (a finite y_R) but the class handles only exact or right-censored times. The last two are the same checks the class's own $new() makes, so a class excluded for either reason would also fail to construct on des_obj. Ordinary right-censoring alone never excludes a class.

A class that is design-compatible but whose registered required_packages are not all installed is excluded from applicable_design_classes and reported separately, by class name, in unavailable_due_to_missing_packages – so callers can tell "not applicable to this design" apart from "applicable, but an optional dependency isn't installed". Package availability is never a reason a class is treated as design-incompatible.

Construction itself does not compute any estimates, p-values, or confidence intervals – it only discovers and validates which inference classes are applicable and does not eagerly construct any of them. This class's run_all_inference() method does that: it constructs and fits every applicable class and returns a uniform comparison across them (see that method's own documentation for the output schema, the CI/p-value method selection policy, and the screen/html/plots/pdf/ save_results_as_JSON output options). lock_objects = FALSE allows ad hoc fields to be attached to an instance after construction.

Every row this class discovers and fits is a test about the same outcome variable, by construction. response_type is a required, immutable constructor argument on Design (read-only thereafter via get_response_type()), and this class discovers every candidate in applicable_design_classes from one attached Design object's one response_type – there is no code path here that spans two response types in a single instance. This matters beyond bookkeeping: a planned comparison-across-classes feature (a single combined-evidence p-value summarizing every row, via a dependence-robust combination test) relies on every combined class sharing one sharp null of "no treatment effect on this outcome" – which only holds when every test concerns the same outcome variable (combining, say, a survival model's p-value with an unrelated continuous-outcome model's p-value would not be valid, since a real effect on one with none on the other is entirely plausible). That precondition is guaranteed here structurally, not by caller discipline.

Same-Y does not mean same estimand, and that matters for interpretation. Rows discovered here routinely test genuinely different \(\theta_i\) on the same outcome – a mean difference, a log-odds ratio under one link, a rank-based effect, a quantile shift – each \(\theta_i\) its own parameterization's own null. The combined \(H_0: \theta_1 = 0 \cap \dots \cap \theta_k = 0\) is one coherent claim (Fisher's unit-level sharp null: no treatment effect whatsoever) only under a randomization-based/exact procedure, where every possible summary of "effect" is simultaneously zero by construction. Asymptotic/likelihood-based procedures instead test a weak, population-level null specific to their own parameterization, and weak nulls for genuinely different summaries are not generally nested – treatment can shift a distribution's variance or a high quantile while leaving its mean exactly unchanged, so "mean difference = 0" does not imply "quantile effect = 0" outside location-shift-style models. This is comparatively safe across different link functions for the same latent effect (e.g. cauchit/probit/cloglog/logit on the same binary/ordinal response, which typically share one underlying latent-variable null) and comparatively riskier across different kinds of summary (a mean-difference test combined with a rank-based test combined with a quantile-regression test). Under that weak-null reading, a rejection is more honestly read as "at least one specific summary of this outcome's distribution differs" rather than "there is one coherent nonzero effect" – reinforcing, not loosening, the interpretation caveat below.

Combined Evidence interpretation caveat (read before using combined_evidence$pval): the Cauchy combination test is a union-intersection test of \(H_0: \theta_1 = 0 \cap \theta_2 = 0 \cap \dots \cap \theta_k = 0\) against the alternative that at least one \(\theta_i \neq 0\). A significant combined_evidence$pval is therefore evidence of an effect in at least one of these senses, not evidence for a specific estimate or direction – it does not say which class's estimand is nonzero, nor does a small combined p-value imply every (or even most) constituent p-values were small. Do not report combined_evidence$pval as if it estimated a single effect size, and do not treat it as validating any one class's estimate over another's; its only valid use is as evidence that *some* legitimate way of looking for a treatment effect on this outcome found one. This guarantee assumes every constituent p_i is itself valid (i.e. uniform under its own null) – the Cauchy combination's dependence-robust size control says nothing about which such p_i is small, so a single miscalibrated or misspecified procedure (e.g. an asymptotic approximation that breaks down for this sample) can dominate the combined result the same way it would dominate a plain minimum-p-value test, even when every other procedure shows nothing. A significant combined_evidence$pval is worth cross-checking against the per-estimand CI-forest plot (plots$ci_forest) before trusting it – one outlying interval sitting apart from a cluster of concordant ones is a miscalibration flag, not confirmed evidence.

This same-Y precondition is guaranteed within one InferenceSuite instance structurally (one Design, one response_type), but the architecture cannot stop a caller from manually combining raw pvals pulled from two separate InferenceSuite objects' results_tables outside cct_combine_pvalues() – doing so is outside this function's validity guarantee and is not a supported use of this metric.

References

Madigan, D., Ryan, P. B., and Schuemie, M. (2013), "Does design matter? Systematic evaluation of the impact of analytical choices on effect estimates in observational studies," Therapeutic Advances in Drug Safety, 4(2), 53-62, PMID 25083251 – the motivating finding behind this class's "every legitimate way to look for an effect, compared honestly" default output.

Liu, Y. and Xie, J. (2020), "Cauchy combination test: a powerful test with analytic p-value calculation under arbitrary dependency structures," Journal of the American Statistical Association, 115(529), 393-402 – run_all_inference()'s Combined Evidence Metric.

Public fields

applicable_design_classes

Character vector of applicable inference class names derived during initialization.

unavailable_due_to_missing_packages

A named list, one entry per otherwise-design-compatible class whose registered required_packages are not all installed: names are class names, values are the character vector of missing package names. These classes are excluded from applicable_design_classes but are reported here separately from plain design/response-type incompatibility (see the class-level "Compatibility rules"), so callers can distinguish "not applicable to this design" from "applicable, but an optional dependency isn't installed." Empty named list if every design-compatible class has all required packages available.

Methods


InferenceSuite$new()

Discover every Inference class applicable to des_obj (see the class-level documentation for the compatibility rules) and validate any per-class constructor overrides in inference_params, storing applicable_design_classes for later use. This constructor does not instantiate any Inference object itself; callers are expected to construct the specific classes they need (optionally passing the validated inference_params) from the discovered list.

Usage

InferenceSuite$new(des_obj, model_formula = NULL, inference_params = list())

Arguments

des_obj

A completed Design object (validated via is(des_obj, "Design") when assertions are enabled; see toggle_asserts).

model_formula

Accepted for interface/future-extension purposes but currently not used anywhere in this method's body – supplying a non-NULL value has no effect on discovery, validation, or any stored state. Do not rely on this parameter to affect covariate adjustment; a design's own model formula and design matrix are what individual Inference classes actually consult when later constructed from this suite's discovered class list.

inference_params

A named list of lists supplying additional constructor arguments for specific inference classes. Each name must be the name of a concrete Inference subclass that is applicable to des_obj (checked against applicable_design_classes once discovered – an inapplicable class name raises an error); the corresponding list contains keyword arguments (beyond des_obj) forwarded to that class's initialize, and every argument name supplied must match a formal parameter of that class's initialize method (other than des_obj and ...) or an error is raised naming the unknown argument(s) and the valid ones. Defaults to an empty list (no extra arguments for any class).


InferenceSuite$run_all_inference()

Construct and fit every class in applicable_design_classes, and report one uniform comparison row per class – estimate, SE, CI, p-value (each via that row's own method sentinel), likelihood tier, estimand (where declared), fit time, captured warnings, and status. Unlike the constructor, this method fits models and is not free; call it explicitly when you want the comparison, not automatically.

A single class's construction or fit failure never aborts the report – it is caught and recorded as that class's status/message.

Side effects (v1.0.0 slice): screen prints each row as its class finishes fitting (computation order), not buffered to the end, with a percent-done/estimated-time-remaining progress bar line underneath each row (the ETA is the mean per-class elapsed time so far times classes remaining), followed by a footer listing classes excluded for missing optional packages. html = TRUE writes a self-contained, timestamped HTML report (the same table plus the same footer) to output_dir and opens it via browseURL; it requires the utils package. When the optional ggplot2 package is installed, the HTML report also embeds the plots visualizations as inline PNGs; pdf = TRUE saves them to a PDF file (see plots and pdf below).

Usage

InferenceSuite$run_all_inference(
  screen = TRUE,
  html = FALSE,
  alpha = 0.05,
  save_results_as_JSON = FALSE,
  plots = screen,
  pdf = FALSE,
  classes = NULL,
  exclude_classes = character(),
  max_secs_per_class = NULL,
  num_cores = 1L,
  formulas = NULL,
  methods = NULL,
  basic_bootstrap = FALSE,
  compute_conf_intervals = FALSE,
  output_dir = "~",
  r = NULL,
  B = NULL,
  combined_evidence_estimands = NULL,
  combined_evidence_weighting = c("estimand_grouped", "equal", "custom"),
  combined_evidence_weights = NULL
)

Arguments

screen

Print results to the console as each class finishes. At least one of screen/html must be TRUE.

html

Render, save (output_dir, timestamped filename), and auto-open a self-contained HTML report of the results.

alpha

Significance level: confidence intervals are computed at 1 - alpha and alpha is the significance threshold used anywhere the report flags significance. Default 0.05. With compute_conf_intervals = TRUE and the "param_boot" sentinel in the run, the parametric-bootstrap likelihood-ratio CI runs at B (default 199), whose smallest attainable p-value is \(2/(B+1)\); when \(B < 2/\alpha - 1\) the run errors before any fitting, naming the minimum B (pass a larger B, leave "param_boot" out of methods, or turn CIs off).

save_results_as_JSON

If TRUE, serialize the return object (excluding plot objects) to a timestamped JSON file in output_dir. Requires the optional jsonlite package; if it is not installed, a warning() is issued and this artifact is skipped rather than erroring. Default FALSE.

plots

If TRUE, build and display (on the current graphics device) one visualization per estimand: an annotated confidence-interval forest plot (a combined p-value/width label centered above each interval, class/method label right-aligned on each row, color-keyed to significance at alpha) stacked over its own “Estimates” box-and-whisker subplot – a free x-axis (same label, same log10/linear choice as the forest, but its own limits) summarizing the point estimates, one point per inference class/formula, collapsed over method/type since those share one estimate. That subplot scales with how many distinct estimates there are: none for a single estimate (redundant with the forest's own dot), dots alone for 2-5, and dots over a box-and-whisker for more than 5. Built with ggplot2 and stacked into a single gtable grob (draw with grid::grid.draw()); requires the optional ggplot2 package; if it is not installed, a warning() is issued and plotting is skipped rather than erroring. Defaults to the value of screen.

pdf

If TRUE, save the visualization to one timestamped multi-page PDF file in output_dir (one page per estimand; page height scales with the largest estimand's number of CI rows). Same ggplot2 dependency and missing-package handling as plots. Default FALSE.

classes

Optional character vector restricting which applicable classes to fit – e.g. re-running against only the few classes a user is actually deciding between, without reconstructing the suite. Every name must already be in applicable_design_classes or this errors, naming the unknown name(s) and the valid ones. NULL (default) fits every applicable class.

exclude_classes

Optional character vector of applicable classes to skip, applied after classes. Same validation as classes. Default none.

max_secs_per_class

Optional per-class elapsed-time limit in seconds (via setTimeLimit), after which that class's row gets status = "timeout" instead of hanging the whole report. Protects against one pathological class (e.g. a bootstrap/randomization method with many replicates) blocking every other class. Known limitation: R's time limits are checked at R-level interrupt points, so this reliably cuts off slow R-level work but is not guaranteed to interrupt one very slow single native (C/C++/BLAS) call with no intervening R-level check. NULL (default) means no limit.

num_cores

If greater than 1, fit classes in parallel across this many forked workers (one parallel::mcparallel() child per task) – Unix/Linux only; on other platforms this falls back to sequential (num_cores = 1) with a warning(). Screen output changes under parallel execution: fitting is a single blocking call that only returns once every worker has finished, so there is no meaningful per-class ETA to show while running – screen = TRUE instead prints a "fitting N classes across K workers" message up front, then every result row together once complete, then a total-elapsed-time summary line (a deliberate design choice, not a degraded default). Default 1L (sequential, with the normal incremental streaming/progress bar). Reproducibility: the run draws one integer from the global RNG stream and runs every task (class, method and type) from its own seed derived from it and the task's name, restoring the global stream after each task. A run after set.seed() therefore gives the same results every time, with any num_cores, and a task gives the same result whichever other tasks run with it.

formulas

NULL (default), a single formula (~ .), a single formula string ("~ ."), or a collection of either – including c(~ 1, ~ .), which base R already returns as a plain list of formula objects (formulas have no c() method of their own), or a character vector (c("~ .", "~ age + sex * smoking")). NULL means each class fits once with its own default formula – identical to omitting this argument entirely, since model_formula = NULL at construction already resolves to des_obj$get_design_formula() (default ~ .). When non-NULL, only classes whose constructor syntactically accepts a model_formula argument are fit once per formula in formulas (one results_table row each, disambiguated in results by "<class>[<formula>]" names); classes without a model_formula constructor argument at all still fit exactly once, ignoring formulas. Note this is a syntactic check (does the constructor accept one), not a semantic one (does the fit actually use it) – some classes accept-and-ignore model_formula (e.g. InferenceAllSimpleAverageDiff's unadjusted Welch's t-test).

methods

NULL (default), a character vector of method sentinel strings, or a named list mapping each sentinel to a character vector of requested type values, or NULL, restricting which inference method(s) – and, for the three resampling sentinels marked "typed" below, which resampling/CI- construction type flavor(s) – get fit and reported per class. NULL considers every sentinel listed under “Valid sentinels” below, and for each typed sentinel, every type value that class supports (queried at runtime via its own get_supported_bootstrap_ {pval,ci}_types() / get_supported_bayesian_bootstrap_ {pval,ci}_types() / get_supported_rand_bootstrap_ {pval,ci}_types() accessor – never a hardcoded type table in this package), except class/method/type combinations declared in EDI_COMPREHENSIVE_SLOW_PATHS. Those implemented but prohibitively slow paths are omitted only from this default selection. Supplying methods explicitly opts into the named sentinel/type combinations even when the registry marks them slow. Thus the default remains broad without allowing known multi-minute paths to dominate a routine report; it is not a single "best available" cascade. List-shaped example: methods = list(bootstrap = c("percentile", "bca"), rand_bootstrap = NULL) fits only "bootstrap" (restricted to the "percentile"/"bca" types that class actually supports) and "rand_bootstrap" (every type that class supports); a sentinel present as a list name with value NULL still means "every valid type" for it, exactly like the flat-vector shape – to not fit a sentinel at all, simply don't name it. Requesting a type for a sentinel with no type axis (any sentinel not marked "typed" below) errors. Valid sentinels, each corresponding to one asymptotic/exact/ randomization/resampling inference family a class may (or may not) implement:

"wald"

Asymptotic Wald inference – compute_asymp_confidence_interval()/ compute_asymp_two_sided_pval() (capability "wald"). The standard closed-form normal-approximation CI/test.

"exact"

Exact inference – compute_exact_confidence_interval()/ compute_exact_two_sided_pval_for_treatment_effect() (capability "exact_test"). Finite-sample-exact methods (e.g. Fisher's exact test, exact binomial).

"rand"

Randomization inference – compute_rand_confidence_interval()/ compute_rand_two_sided_pval() (capabilities "randomization_ci"/"randomization_test" – distinct capability names for the CI vs. p-value side, since a class can support one without the other). Design-based inference via re-randomizing the observed treatment assignment.

"rand_bootstrap" (typed)

Randomization-bootstrap inference – compute_rand_bootstrap_confidence_interval()/ compute_rand_bootstrap_two_sided_pval() (capabilities "randomization_bootstrap_ci"/"randomization_bootstrap" – distinct capability names for the CI vs. p-value side, since a class can support one without the other). Resamples under the randomization null rather than the usual iid-resampling bootstrap. type (both sides agree on the same four values, unlike "bootstrap"/"bayes_boot" below): "percentile", "studentized", "symmetric-percentile-t", "smoothed".

"jackknife"

Jackknife-Wald inference – compute_jackknife_wald_confidence_interval()/ compute_jackknife_wald_two_sided_pval() (capability "jackknife"). Leave-one-out variance estimate feeding a Wald-style CI/test.

"score"

Score (Rao) test – compute_score_confidence_interval()/ compute_score_two_sided_pval() (capability "likelihood_tests", one of its three independent sub-procedures).

"lik_ratio"

Likelihood-ratio test – compute_lik_ratio_confidence_interval()/ compute_lik_ratio_two_sided_pval() (capability "likelihood_tests").

"gradient"

Gradient test – compute_gradient_confidence_interval()/ compute_gradient_two_sided_pval() (capability "likelihood_tests").

(The plain, "best available" auto-selecting compute_lik_ratio_bartlett_two_sided_pval()/ compute_lik_ratio_bartlett_confidence_interval() dispatcher is deliberately not its own sentinel -- it only picks between the two explicit variants below depending on which this class implements, so it is never a distinct inference procedure.)
"lik_ratio_bartlett_approx"

Bartlett-corrected likelihood-ratio test, Monte-Carlo-approximated correction factor pinned explicitly (for reproducibility) – compute_lik_ratio_bartlett_approx_confidence_interval()/ compute_lik_ratio_bartlett_approx_two_sided_pval() (capability "likelihood_tests"; degrades to NA for classes without an approximate Bartlett factor).

"lik_ratio_bartlett_exact"

Bartlett-corrected likelihood-ratio test, closed-form analytic correction factor pinned explicitly – compute_lik_ratio_bartlett_exact_confidence_interval()/ compute_lik_ratio_bartlett_exact_two_sided_pval() (capability "likelihood_tests"; degrades to NA for classes without an exact Bartlett factor).

"param_boot"

Bootstrap-calibrated likelihood-ratio test – compute_lik_ratio_bootstrap_confidence_interval()/ compute_lik_ratio_bootstrap_two_sided_pval() (capability "parametric_likelihood_bootstrap").

"param_boot_direct"

Direct parametric-bootstrap estimate/CI/pval for the treatment coefficient itself – compute_param_bootstrap_confidence_interval()/ compute_param_bootstrap_pval() (capability "parametric_likelihood_bootstrap"; distinct from "param_boot" above, which is a bootstrap-calibrated likelihood-ratio test, not a direct estimate).

"bayes_boot" (typed)

Bayesian bootstrap inference – compute_bayesian_bootstrap_confidence_interval()/ compute_bayesian_bootstrap_two_sided_pval() (capability "bayesian_bootstrap"). CI-side type: "percentile", "basic", "wald", "studentized", "bootstrap-t", "bca"; pval-side type swaps "basic" for "symmetric" (all others the same).

"bootstrap" (typed)

Nonparametric bootstrap inference – compute_bootstrap_confidence_interval()/ compute_bootstrap_two_sided_pval() (capability "nonparametric_bootstrap"). CI-side type: "percentile", "basic", "studentized", "bootstrap-t", "symmetric-percentile-t", "bca", "prepivoted", "double-bootstrap", "calibrated", "smoothed"; pval-side type is a smaller set – "percentile", "symmetric", "studentized", "bootstrap-t", "bca" – neither "basic" nor the other CI-only variants apply on the pval side.

For the three "typed" sentinels above, an exhaustive type list is documented here for orientation only – the actual set consulted at runtime always comes from that class's own accessor (see the top of this section), so a class need not support every value listed. For each class, only sentinels the class has any CI or p-value capability for (among the requested methods) get a row; for a typed sentinel, one row per type that class actually supports (intersected with any requested type subset) – a class with zero applicable sentinels, or a typed sentinel with zero resulting types, still gets exactly one row with method/type = NA_character_ (mirrors the pre-methods "no capability" row) rather than being silently dropped. A class contributing more than one applicable-sentinel row is disambiguated in results/results_table by "<class>{<method>}" or "<class>{<method>:<type>}" (or with a "[<formula>]" tag too under simultaneous formulas fan-out) names. Unlike the removed cascade, ci_method/pval_method on a given row now always match that row's own method (or are NA if this class lacks that half of the sentinel's capability, including when type is valid on one side but not the other) – there is no fallback to a different sentinel within one row.

basic_bootstrap

FALSE (default). Convenience flag: when TRUE, restricts every typed sentinel ("bootstrap"/ "bayes_boot"/"rand_bootstrap") to just that class's first (i.e. default) type value instead of fitting every type it supports – "just run the default bootstrap flavor for nonparametric/Bayesian/randomization resampling" without having to spell out methods = list(bootstrap = ..., bayes_boot = ..., rand_bootstrap = ...) by hand. Only takes effect for a typed sentinel the caller didn't already restrict via an explicit methods list entry – an explicit type request there always wins over this flag. No effect on non-typed sentinels ("param_boot"/"param_boot_direct" included – neither has a type axis, so they already run their one procedure).

compute_conf_intervals

FALSE (default). When FALSE, every task's confidence-interval side (ci_a/ci_b/ ci_method) is skipped entirely – only the p-value side runs. Several sentinels' CI search (Bartlett-approx, "rand", "rand_bootstrap", "param_boot") re-invokes the same expensive machinery as its own p-value roughly 15-40 times per bound during root-finding, by far the dominant cost of a full run_all_inference() run for those sentinels; skipping it can cut total runtime dramatically. ci_a/ci_b/ci_method stay present but always NA in results_table (stable schema either way) and are omitted entirely from the live/print/HTML display tables when FALSE. Set TRUE to compute CIs as before.

output_dir

Directory for the html/pdf/ save_results_as_JSON output files. Default "~" (the user's home directory), not the current working directory – these calls are routinely made from inside the package's own source tree (a demo/dev script run from R/EDI/), and a stray timestamped report left in getwd() there is exactly the kind of untracked file that can end up bundled into a source tarball (R CMD build) or committed by accident. Pass an explicit path (e.g. the current directory, or a temp directory) to write elsewhere.

r

NULL (default: each method's own default, 501 today) or a positive integer: the number of draws for every randomization procedure in the run – the randomization test and CI ("rand", passed as their r) and the randomization-bootstrap test and CI ("rand_bootstrap", passed as their B).

B

NULL (default: each method's own default – 501 for the nonparametric and Bayesian bootstrap, 199 for the parametric bootstrap) or a positive integer: the number of replicates for every bootstrap procedure in the run – nonparametric ("bootstrap"), Bayesian ("bayes_boot"), parametric-bootstrap estimate ("param_boot_direct") and parametric-bootstrap likelihood-ratio ("param_boot") tests and CIs. The Monte-Carlo Bartlett factor ("lik_ratio_bartlett_approx") keeps its own default. See alpha for the minimum B of the "param_boot" CI. A B below 5 (the bootstrap methods' min_number_usable_samples) errors before any fitting when the run includes one of these methods.

combined_evidence_estimands

NULL (default: include every declared estimand), or a character vector of estimand values to restrict the Combined Evidence p-value/weights to. Validated argument-time against the estimand values actually declared among classes/exclude_classes-filtered candidates.

combined_evidence_weighting

One of "estimand_grouped" (default – w_i = 1 / (G * m_i)), "equal" (flat w_i = 1/k), or "custom" (caller supplies combined_evidence_weights).

combined_evidence_weights

Named numeric vector (inference_class name -> weight), required when and only when combined_evidence_weighting = "custom". Names must be a subset of the classes being fit; an unnamed usable class defaults to weight 0 (excluded). Need not pre-sum to 1.

Returns

Invisibly, an object of class c("EDIInferenceSuiteResults", "list") with elements results (one named sub-list per class, in computation order), results_table (the same rows as a flat data.frame, sorted/grouped by estimand – NA_character_ last – with a secondary sort by inference_class; includes the weight column driven by combined_evidence_weighting/ combined_evidence_estimands; followed by four procedure-validity columns read from the package's procedure-regime / convergence-rate registry: regime ("asymptotic" or "finite_sample" – valid only as the effective sample size grows, or valid at every sample size by construction), n_eff (the effective-sample-size rule for this class, design and procedure and its realised value on this design's data, e.g. "n_pairs = 25"; NA for the value when the rule does not apply to the data), size_order (the expected order of the size / coverage error in n_eff, e.g. "O(n_eff^-1)"; "exact" for finite-sample procedures, "O(1)" when the error does not vanish, "unknown" when no rate is known) and rate_basis (why that order is believed: "theory", "literature", "empirical", "assumed_default" or "unknown"); all four are NA for a row with no registered procedure), combined_evidence (list(pval, stat, method = "cauchy_combination", n_classes_used, n_estimand_groups, estimands_used, weighting, weights_used, classes_used) – the Cauchy-combination-test p-value/statistic across all usable rows under the resolved weighting policy; weights_used/classes_used are keyed/valued by each row's results name, not results_table$inference_class directly, since that column can repeat under formulas; pval = stat = NA_real_ if fewer than 2 rows are usable), design, alpha, resample_counts (list(r, B) as passed, NULL entries meaning method defaults), unavailable_due_to_missing_packages, plots (list(ci_forest); ci_forest is a named list of one gtable grob per estimand – the CI forest stacked over its “Estimates” box-and-whisker subplot; draw with grid::grid.draw() or pass to ggplot2::ggsave() – possibly empty – rather than a single plot, since the visualization is split one-per-estimand), files (list(html, pdf, json), each a path or NULL; pdf is one multi-page PDF with one page per estimand), timestamp, total_secs, and edi_version.


InferenceSuite$clone()

The objects of this class are cloneable with this method.

Usage

InferenceSuite$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# \donttest{
seq_des = DesignSeqOneByOneBernoulli$new(n = 20, response_type = "continuous")
for (i in 1:20) {
  seq_des$add_one_subject_to_experiment_and_assign(data.frame(x = rnorm(1)))
}
seq_des$add_all_subject_responses(rnorm(20))

suite = InferenceSuite$new(seq_des)
suite$applicable_design_classes
#> [1] "InferenceAllSimpleAverageDiff"       "InferenceAllSimpleMeanDiffPooledVar"
#> [3] "InferenceAllSimpleWilcox"            "InferenceContinLin"                 
#> [5] "InferenceContinOLS"                  "InferenceContinQuantileRegr"        
#> [7] "InferenceContinRobustRegr"          

# Fit and compare every applicable class (Wald and randomization only, with
# 99 draws, to keep the example short; omit `methods` and `r` for every method):
results = suite$run_all_inference(screen = TRUE, methods = c("wald", "rand"), r = 99)
#> inference       cov      estimand    est       se        pval       pval method     status 
#> class           mod                                                                        
#> ===========================================================================================
#> Classes 0/14  [                0%                 ] Status: Estimating...
Avg Δ                    mean Δ      0.226     0.498     6.56e-01   wald            ok     
#> Classes 1/14  [==             7%                ] Estimated Time Left: 0s
Avg Δ                    mean Δ      0.226     0.498     7.40e-01   rand            ok     
#> Classes 2/14  [====           14%               ] Estimated Time Left: 0s
Avg Δ Pooled …           mean Δ      0.226     0.512     6.65e-01   wald            ok     
#> Classes 3/14  [=======        21%               ] Estimated Time Left: 0s
Avg Δ Pooled …           mean Δ      0.226     0.512     8.00e-01   rand            ok     
#> Classes 4/14  [=========      28%               ] Estimated Time Left: 0s
Wilcox                   HL shift    0.0404    0.621     9.39e-01   wald            ok     
#> Classes 5/14  [===========    35%               ] Estimated Time Left: 0s
Wilcox                   HL shift    0.0404    0.621     9.80e-01   rand            ok     
#> Classes 6/14  [============== 42%               ] Estimated Time Left: 0s
Lin             ~.       mean Δ      0.350     0.460     4.58e-01   wald            ok     
#> Classes 7/14  [============== 50%               ] Estimated Time Left: 0s
Lin             ~.       mean Δ      0.350     0.460     6.20e-01   rand            ok     
#> Classes 8/14  [============== 57%               ] Estimated Time Left: 0s
OLS             ~.       mean Δ      0.338     0.514     5.20e-01   wald            ok     
#> Classes 9/14  [============== 64% ==            ] Estimated Time Left: 0s
OLS             ~.       mean Δ      0.338     0.514     6.00e-01   rand            ok     
#> Classes 10/14 [============== 71% ====          ] Estimated Time Left: 0s
Median Regr     ~.       median ef…  0.181     0.633     7.79e-01   wald            ok     
#> Classes 11/14 [============== 78% ======        ] Estimated Time Left: 0s
Median Regr     ~.       median ef…  0.181     0.633     7.40e-01   rand            ok     
#> Classes 12/14 [============== 85% =========     ] Estimated Time Left: 0s
Robust Regr     ~.       mean Δ      0.357     0.546     5.22e-01   wald            ok     
#> Classes 13/14 [============== 92% ===========   ] Estimated Time Left: 0s
Robust Regr     ~.       mean Δ      0.357     0.546     6.20e-01   rand            ok     
#> Classes 14/14 [============= 100% ==============] Estimated Time Left: 0s
-------------------------------------------------------------------------------------------
#> Status: Completed in 1s.
#> 
#>   Estimand: HL shift (2 inferences)     : p = 0.970
#>   Estimand: mean Δ (10 inferences)      : p = 0.635
#>   Estimand: median effect (2 inferences): p = 0.761
#> 
#> Combined evidence against the sharp null across 3 estimands
#> (14 inferences, weighting = uniform within estimand):
#> p = 0.922
results$results_table
#>                        inference_class method type cov_model response_type
#> 1             InferenceAllSimpleWilcox   wald <NA>      <NA>    continuous
#> 2             InferenceAllSimpleWilcox   rand <NA>      <NA>    continuous
#> 3        InferenceAllSimpleAverageDiff   wald <NA>      <NA>    continuous
#> 4        InferenceAllSimpleAverageDiff   rand <NA>      <NA>    continuous
#> 5  InferenceAllSimpleMeanDiffPooledVar   wald <NA>      <NA>    continuous
#> 6  InferenceAllSimpleMeanDiffPooledVar   rand <NA>      <NA>    continuous
#> 7                   InferenceContinLin   wald <NA>        ~.    continuous
#> 8                   InferenceContinLin   rand <NA>        ~.    continuous
#> 9                   InferenceContinOLS   wald <NA>        ~.    continuous
#> 10                  InferenceContinOLS   rand <NA>        ~.    continuous
#> 11           InferenceContinRobustRegr   wald <NA>        ~.    continuous
#> 12           InferenceContinRobustRegr   rand <NA>        ~.    continuous
#> 13         InferenceContinQuantileRegr   wald <NA>        ~.    continuous
#> 14         InferenceContinQuantileRegr   rand <NA>        ~.    continuous
#>    design_family likelihood_tier  estimate        se ci_a ci_b ci_method
#> 1            iid            none 0.0403664 0.6207793   NA   NA      wald
#> 2            iid            none 0.0403664 0.6207793   NA   NA      rand
#> 3            iid            none 0.2255450 0.4976581   NA   NA      wald
#> 4            iid            none 0.2255450 0.4976581   NA   NA      rand
#> 5            iid            none 0.2255450 0.5117447   NA   NA      wald
#> 6            iid            none 0.2255450 0.5117447   NA   NA      rand
#> 7            iid            full 0.3502162 0.4601855   NA   NA      wald
#> 8            iid            full 0.3502162 0.4601855   NA   NA      rand
#> 9            iid            full 0.3376738 0.5136311   NA   NA      wald
#> 10           iid            full 0.3376738 0.5136311   NA   NA      rand
#> 11           iid           quasi 0.3571322 0.5464384   NA   NA      wald
#> 12           iid           quasi 0.3571322 0.5464384   NA   NA      rand
#> 13           iid            none 0.1808565 0.6331524   NA   NA      wald
#> 14           iid            none 0.1808565 0.6331524   NA   NA      rand
#>         pval pval_method                   estimand tau    fit_secs warnings
#> 1  0.9394400        wald       hodges_lehmann_shift  NA 0.047877312     <NA>
#> 2  0.9800000        rand       hodges_lehmann_shift  NA 0.014654398     <NA>
#> 3  0.6558297        wald            mean_difference  NA 0.013603687     <NA>
#> 4  0.7400000        rand            mean_difference  NA 0.008312941     <NA>
#> 5  0.6646508        wald            mean_difference  NA 0.004663944     <NA>
#> 6  0.8000000        rand            mean_difference  NA 0.007593632     <NA>
#> 7  0.4577079        wald            mean_difference  NA 0.050918102     <NA>
#> 8  0.6200000        rand            mean_difference  NA 0.105704069     <NA>
#> 9  0.5197106        wald            mean_difference  NA 0.007376194     <NA>
#> 10 0.6000000        rand            mean_difference  NA 0.009426117     <NA>
#> 11 0.5221357        wald            mean_difference  NA 0.047955275     <NA>
#> 12 0.6200000        rand            mean_difference  NA 0.057656288     <NA>
#> 13 0.7786017        wald quantile_regression_effect 0.5 0.039856195     <NA>
#> 14 0.7400000        rand quantile_regression_effect 0.5 0.123550892     <NA>
#>    status message     weight        regime  n_eff    size_order      rate_basis
#> 1      ok    <NA> 0.16666667    asymptotic n = 20   O(n_eff^-1) assumed_default
#> 2      ok    <NA> 0.16666667 finite_sample n = 20         exact          theory
#> 3      ok    <NA> 0.03333333    asymptotic n = 20   O(n_eff^-1) assumed_default
#> 4      ok    <NA> 0.03333333 finite_sample n = 20         exact          theory
#> 5      ok    <NA> 0.03333333    asymptotic n = 20   O(n_eff^-1) assumed_default
#> 6      ok    <NA> 0.03333333 finite_sample n = 20         exact          theory
#> 7      ok    <NA> 0.03333333    asymptotic n = 20   O(n_eff^-1) assumed_default
#> 8      ok    <NA> 0.03333333 finite_sample n = 20         exact          theory
#> 9      ok    <NA> 0.03333333    asymptotic n = 20   O(n_eff^-1) assumed_default
#> 10     ok    <NA> 0.03333333 finite_sample n = 20         exact          theory
#> 11     ok    <NA> 0.03333333    asymptotic n = 20       unknown         unknown
#> 12     ok    <NA> 0.03333333 finite_sample n = 20         exact          theory
#> 13     ok    <NA> 0.16666667    asymptotic n = 20 O(n_eff^-2/3)      literature
#> 14     ok    <NA> 0.16666667 finite_sample n = 20         exact          theory
# }