Skip to contents

Intermediate base class for asymptotic inference families that expose likelihood / partial-likelihood / working-likelihood test paths in addition to Wald inference. The term "likelihood" is used broadly: subclasses may be backed by a true full likelihood, a partial likelihood (e.g. Cox PH), a quasi-likelihood (e.g. GEE, quasi-Poisson), or a composite/combined likelihood. Classes requiring a full generative likelihood — i.e. those supporting parametric-bootstrap LR calibration — inherit instead from InferenceParamBootstrap.

Details

Information source. Wald standard errors, p-values and confidence intervals always use the observed information (the negative Hessian of the log-likelihood at the MLE), the usual choice for Wald inference (Efron and Hinkley 1978) and what MASS::polr() and ordinal::clm() report; for a canonical-link GLM (logistic, Poisson) the observed and expected information coincide, so it is also what glm() reports. The information preference set with set_information_preference() affects only score (Rao) tests and score confidence intervals; "fisher" (expected information) is the default there where the class supports it, "observed" otherwise. Exceptions: InferenceIncidProbitRegr exposes only the expected information, and the Wald standard errors of InferenceIncidBinomialIdentityRiskDiff and InferenceIncidLogBinomial come from their IRLS fits' expected information, as glm() reports for these non-canonical links.

References

Efron, B., and Hinkley, D. V. (1978). "Assessing the accuracy of the maximum likelihood estimator: Observed versus expected Fisher information." Biometrika, 65(3), 457-483. doi:10.1093/biomet/65.3.457

Methods

+ inherited public methods from InferenceMLEorKMSummaryTable
+ inherited public methods from InferenceAsymp
+ inherited public methods from InferenceJackknife
+ inherited public methods from InferenceBayesianBootstrap
+ inherited public methods from InferenceRandBootstrapCI
+ inherited public methods from InferenceRandBootstrap
+ inherited public methods from InferenceNonParamBootstrap
+ inherited public methods from InferenceRandCI
+ inherited public methods from InferenceRand
+ inherited public methods from Inference


InferenceAsympLik$compute_asymp_confidence_interval()

Computes an asymptotic confidence interval for the treatment effect using the configured likelihood-backed test. Wald intervals use the fitted estimate and standard error; score, likelihood-ratio, gradient, and Bartlett-corrected likelihood-ratio intervals are obtained by inverting the corresponding test. For purely Wald asymptotic dispatch, see InferenceAsymp. Wald inference always uses the observed information; the information preference (set_information_preference()) applies to score tests and score confidence intervals only.

Usage

InferenceAsympLik$compute_asymp_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level; the interval has confidence level 1 - alpha. Default 0.05.

Returns

A confidence interval.


InferenceAsympLik$compute_asymp_two_sided_pval()

Computes an asymptotic two-sided p-value for the treatment effect using the configured likelihood-backed test. Depending on testing_type, this evaluates a Wald, score, likelihood-ratio, gradient, or Bartlett-corrected likelihood-ratio statistic under the null value delta. For count-specific likelihood families, see InferenceCountLikelihood. Wald inference always uses the observed information; the information preference (set_information_preference()) applies to score tests and score confidence intervals only.

Usage

InferenceAsympLik$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect to test against. Default 0.

Returns

The asymptotic p-value.


InferenceAsympLik$set_testing_type()

Sets the asymptotic testing method used by p-values and CIs.

Usage

InferenceAsympLik$set_testing_type(
  testing_type = c("wald", "score", "gradient", "lik_ratio", "lik_ratio_bartlett_approx",
    "lik_ratio_bartlett_exact", "lik_ratio_bartlett_approx_design_conservative")
)

Arguments

testing_type

One of "wald", "score", "gradient", "lik_ratio", "lik_ratio_bartlett_approx", "lik_ratio_bartlett_exact", or "lik_ratio_bartlett_approx_design_conservative". The last is offered only by classes that combine a model-based test with a design-based Wald test (InferenceCountPoisson, InferenceCountKKCondPoissonOneLik, InferenceCountKKHurdlePoissonOneLik): the larger of the approximate Bartlett-corrected likelihood-ratio p-value and the design Wald p-value, and the union of the two intervals. Each class accepts only the types in its get_supported_testing_types().

Returns

The inference object, invisibly.


InferenceAsympLik$set_information_preference()

Sets the information matrix preference used by score (Rao) tests and score confidence intervals. Wald standard errors, p-values and confidence intervals always use the observed information (the negative Hessian of the log-likelihood at the MLE), the usual choice for Wald inference (Efron and Hinkley 1978) and what MASS::polr() and ordinal::clm() report; for a canonical-link GLM (logistic, Poisson) the observed and expected information coincide, so it is also what glm() reports. The information preference set with set_information_preference() affects only score (Rao) tests and score confidence intervals; "fisher" (expected information) is the default there where the class supports it, "observed" otherwise. Exceptions: InferenceIncidProbitRegr exposes only the expected information, and the Wald standard errors of InferenceIncidBinomialIdentityRiskDiff and InferenceIncidLogBinomial come from their IRLS fits' expected information, as glm() reports for these non-canonical links.

Usage

InferenceAsympLik$set_information_preference(
  information_preference = c("auto", "fisher", "observed")
)

Arguments

information_preference

One of "auto", "fisher", or "observed".

Returns

The inference object, invisibly.


InferenceAsympLik$get_testing_type()

Gets the asymptotic testing method used by p-values and CIs.

Usage

InferenceAsympLik$get_testing_type()


InferenceAsympLik$get_information_preference()

Gets the score-test information matrix preference. Wald inference always uses the observed information; the information preference (set_information_preference()) applies to score tests and score confidence intervals only.

Usage

InferenceAsympLik$get_information_preference()


InferenceAsympLik$get_information_source_used()

Gets the actual information source ("fisher", "observed" or "legacy") used by the most recent score-test computation, or NULL before one. Wald standard errors always use the observed information and do not change this value.

Usage

InferenceAsympLik$get_information_source_used()


InferenceAsympLik$get_supported_testing_types()

Gets the asymptotic testing methods supported by this inference object.

Usage

InferenceAsympLik$get_supported_testing_types()


InferenceAsympLik$get_supported_information_preferences()

Gets the information matrix preferences supported by this inference object for score tests and score confidence intervals ("auto", plus "observed" and, where the class has the expected information, "fisher"). Wald standard errors, p-values and confidence intervals always use the observed information (the negative Hessian of the log-likelihood at the MLE), the usual choice for Wald inference (Efron and Hinkley 1978) and what MASS::polr() and ordinal::clm() report; for a canonical-link GLM (logistic, Poisson) the observed and expected information coincide, so it is also what glm() reports. The information preference set with set_information_preference() affects only score (Rao) tests and score confidence intervals; "fisher" (expected information) is the default there where the class supports it, "observed" otherwise. Exceptions: InferenceIncidProbitRegr exposes only the expected information, and the Wald standard errors of InferenceIncidBinomialIdentityRiskDiff and InferenceIncidLogBinomial come from their IRLS fits' expected information, as glm() reports for these non-canonical links.

Usage

InferenceAsympLik$get_supported_information_preferences()


InferenceAsympLik$compute_score_two_sided_pval()

Computes the score two-sided p-value regardless of configured testing type. The score test evaluates the null-restricted fit and uses the configured information matrix preference ("fisher" by default where supported); Wald inference always uses the observed information instead. Compare with compute_asymp_two_sided_pval() for configured-test dispatch.

Usage

InferenceAsympLik$compute_score_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect.


InferenceAsympLik$compute_score_confidence_interval()

Computes the score confidence interval regardless of configured testing type by inverting score-test p-values over candidate treatment effects, each with the configured information matrix preference ("fisher" by default where supported; Wald inference always uses the observed information). Compare with compute_asymp_confidence_interval() for configured-test dispatch.

Usage

InferenceAsympLik$compute_score_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level. Default 0.05.


InferenceAsympLik$compute_lik_ratio_two_sided_pval()

Computes the likelihood-ratio two-sided p-value regardless of configured testing type. This compares unrestricted and null-restricted fits at delta; subclasses may use a full, partial, quasi-, or composite likelihood as described in InferenceAsympLik.

Usage

InferenceAsympLik$compute_lik_ratio_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect.


InferenceAsympLik$compute_lik_ratio_confidence_interval()

Computes the likelihood-ratio confidence interval regardless of configured testing type by inverting likelihood-ratio p-values over candidate treatment effects. Compare with score and gradient intervals in this class.

Usage

InferenceAsympLik$compute_lik_ratio_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level. Default 0.05.


InferenceAsympLik$compute_lik_ratio_bartlett_approx_two_sided_pval()

Computes the approximate (Monte-Carlo) Bartlett-corrected likelihood-ratio two-sided p-value regardless of configured testing type. Returns NA_real_ for subclasses that do not implement an approximate Bartlett correction factor.

The approximate Bartlett factor is estimated by Monte Carlo (e.g. the generic InferenceParamBootstrap factor): B datasets are simulated under the null-restricted fit at delta and refit to approximate E[LR | H0], the quantity a classical analytic Bartlett correction targets exactly. The Monte-Carlo draws are seeded from this object's own seed (see set_seed()), so repeated calls at the same delta with the same B are reproducible; there is no separate seed argument here.

See compute_lik_ratio_bartlett_exact_two_sided_pval() for the closed-form analytic counterpart (no simulation, no B).

Usage

InferenceAsympLik$compute_lik_ratio_bartlett_approx_two_sided_pval(
  delta = 0,
  B = 99
)

Arguments

delta

Null treatment effect. Default 0.

B

Number of Monte-Carlo replicates used to estimate the Bartlett factor. Default 99.


InferenceAsympLik$compute_lik_ratio_bartlett_approx_confidence_interval()

Computes the approximate (Monte-Carlo) Bartlett-corrected likelihood-ratio confidence interval regardless of configured testing type. Returns c(NA_real_, NA_real_) for subclasses that do not implement an approximate Bartlett correction factor.

See compute_lik_ratio_bartlett_approx_two_sided_pval() for what B controls and how the Monte-Carlo seed is inherited from this object's own seed. Each p-value evaluation during the confidence-interval search re-simulates B replicates, so this can be substantially more expensive than the p-value alone.

Usage

InferenceAsympLik$compute_lik_ratio_bartlett_approx_confidence_interval(
  alpha = 0.05,
  B = 99
)

Arguments

alpha

Significance level. Default 0.05.

B

Number of Monte-Carlo replicates used to estimate the Bartlett factor. Default 99.


InferenceAsympLik$compute_lik_ratio_bartlett_exact_two_sided_pval()

Computes the exact (closed-form analytic) Bartlett-corrected likelihood-ratio two-sided p-value regardless of configured testing type. Returns NA_real_ for subclasses that do not implement an exact, bespoke analytic Bartlett correction factor. Concrete families opt in through get_bartlett_factor_exact().

Unlike compute_lik_ratio_bartlett_approx_two_sided_pval(), this path involves no simulation and no Monte-Carlo replicate count.

Usage

InferenceAsympLik$compute_lik_ratio_bartlett_exact_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect. Default 0.


InferenceAsympLik$compute_lik_ratio_bartlett_exact_confidence_interval()

Computes the exact (closed-form analytic) Bartlett-corrected likelihood-ratio confidence interval regardless of configured testing type. Returns c(NA_real_, NA_real_) for subclasses that do not implement an exact, bespoke analytic Bartlett correction factor.

Usage

InferenceAsympLik$compute_lik_ratio_bartlett_exact_confidence_interval(
  alpha = 0.05
)

Arguments

alpha

Significance level. Default 0.05.


InferenceAsympLik$compute_lik_ratio_bartlett_two_sided_pval()

Computes "the best available" Bartlett-corrected likelihood-ratio two-sided p-value regardless of configured testing type: uses the exact (closed-form analytic) factor if this class implements one, otherwise falls back to the approximate (Monte-Carlo) factor. Errors if the class supports neither (see supports_bartlett_likelihood_ratio_exact()/ supports_bartlett_likelihood_ratio_approx()).

This is a convenience entry point for callers who want a Bartlett-corrected p-value without caring which mechanism produced it. Because exact and approximate factors are computed differently (deterministic closed form vs. seeded Monte-Carlo simulation), the same call can silently start returning different numeric results on a future package version once a family gains an exact implementation where previously only the approximate path existed. Callers who need results stable across package versions (e.g. for reproducibility or regression tests) should call compute_lik_ratio_bartlett_approx_two_sided_pval() or compute_lik_ratio_bartlett_exact_two_sided_pval() directly instead.

Usage

InferenceAsympLik$compute_lik_ratio_bartlett_two_sided_pval(delta = 0, B = 99)

Arguments

delta

Null treatment effect. Default 0.

B

Number of Monte-Carlo replicates, used only when the exact factor is unavailable and the approximate factor is used instead. If explicitly supplied but the exact factor is used (so B has no effect), a warning is issued; B left at its default is silently ignored in that case. Default 99.


InferenceAsympLik$compute_lik_ratio_bartlett_confidence_interval()

Computes "the best available" Bartlett-corrected likelihood-ratio confidence interval regardless of configured testing type: uses the exact (closed-form analytic) factor if this class implements one, otherwise falls back to the approximate (Monte-Carlo) factor. Errors if the class supports neither.

See compute_lik_ratio_bartlett_two_sided_pval() for the exact-over-approx selection rule, the B-ignored warning behavior, and why callers who need version-to-version reproducibility should prefer the explicit _approx/_exact methods instead.

Usage

InferenceAsympLik$compute_lik_ratio_bartlett_confidence_interval(
  alpha = 0.05,
  B = 99
)

Arguments

alpha

Significance level. Default 0.05.

B

Number of Monte-Carlo replicates, used only when the exact factor is unavailable and the approximate factor is used instead. Default 99.


InferenceAsympLik$compute_gradient_two_sided_pval()

Computes the gradient two-sided p-value regardless of configured testing type.

Usage

InferenceAsympLik$compute_gradient_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect.


InferenceAsympLik$compute_gradient_confidence_interval()

Computes the gradient confidence interval regardless of configured testing type.

Usage

InferenceAsympLik$compute_gradient_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level. Default 0.05.


InferenceAsympLik$clone()

The objects of this class are cloneable with this method.

Usage

InferenceAsympLik$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.