Skip to contents

InferenceCustomAsymp is intentionally not exported. Extension packages may retrieve it with getFromNamespace("InferenceCustomAsymp", "EDI") while this API is experimental.

Subclasses implement a public fit(estimate_only = FALSE) method and return a named list with the custom-fit result contract:

estimate

Required numeric scalar treatment-effect estimate.

se

Optional numeric scalar standard error. Required for Wald confidence intervals and asymptotic p-values unless estimate_only is TRUE.

df

Optional numeric scalar degrees of freedom. Use NA_real_ for z inference.

model

Optional fitted model object retained for get_mod() and get_summary().

nonestimable_reason

Optional character scalar. When supplied with a non-finite estimate or standard error, EDI records the result as explicitly non-estimable.

Subclasses should use public accessors such as get_analysis_data(), get_response(), get_treatment(), and get_covariates() rather than EDI private fields.

Super class

Inference -> InferenceCustomAsymp

Methods

+ inherited public methods from Inference


InferenceCustomAsymp$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 `NonparametricBootstrap` pulls in both `RandomizationTest` and `RandomizationCI`, and the two provide conflicting `compute_rand_two_sided_pval` implementations.

Usage

InferenceCustomAsymp$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

r

Number of randomization vectors.

delta

Null treatment effect value.

transform_responses

Response 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); see compute_rand_confidence_interval() for the assumptions.

na.rm

Whether to remove non-finite simulated statistics.

show_progress

Whether to show progress.

permutations

Optional pre-generated assignment draws.

type

NULL (default) or "Zhang", the only accepted value. NULL computes the p-value from the randomization draws. "Zhang" instead returns the Zhang exact combined test (see InferenceIncidExactZhang); it applies only to incidence responses on a Bernoulli or matching design. For any other response or design, a non-NULL type is an error; other strings (for example "Fisher" or "exact") are rejected.

args_for_type

NULL or a list keyed by type, used only with type = "Zhang": list(Zhang = list(combination_method = "Stouffer")), where combination_method is "Fisher" (default), "Stouffer" or "min_p".

zero_one_logit_clamp

The 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); see InferenceRand$compute_rand_two_sided_pval().

Returns

A two-sided p-value (a single-tail p-value when alternative is not "two.sided").


InferenceCustomAsymp$fit()

Calls the user-defined fit callback for this custom inference path; see InferenceCustomAsymp.

Usage

InferenceCustomAsymp$fit(estimate_only = FALSE)

Arguments

estimate_only

If TRUE, skip variance calculations.

Returns

A list with fit results.


InferenceCustomAsymp$compute_estimate()

Compute the treatment-effect estimate by delegating to the user-supplied custom estimator. See InferenceCustomRand, InferenceCustomAsymp, and InferenceCustomBoot for related extension classes.

Usage

InferenceCustomAsymp$compute_estimate(estimate_only = FALSE)

Arguments

estimate_only

If TRUE, skip variance calculations.

Returns

The treatment estimate.


InferenceCustomAsymp$compute_asymp_confidence_interval()

Compute asymptotic confidence interval.

Usage

InferenceCustomAsymp$compute_asymp_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level.

Returns

Confidence interval.


InferenceCustomAsymp$compute_asymp_two_sided_pval()

Compute asymptotic p-value.

Usage

InferenceCustomAsymp$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect.

Returns

P-value.


InferenceCustomAsymp$clone()

The objects of this class are cloneable with this method.

Usage

InferenceCustomAsymp$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.