quantile.lr_dist: Quantiles of a likelihood-ratio distribution

View source: R/lr_distribution.R

quantile.lr_distR Documentation

Quantiles of a likelihood-ratio distribution

Description

Discrete inverse-CDF quantiles of \log_{10}\mathrm{LR} under one of the two hypotheses, using R's quantile type-1 definition Q(p) = \inf\{x : F(x) \ge p\} over the active support.

Usage

## S3 method for class 'lr_dist'
quantile(x, probs = c(0, 0.25, 0.5, 0.75, 1), under_h1 = TRUE, ...)

Arguments

x

An lr_dist object (see as_lr_dist() / lr_distribution()).

probs

Numeric vector of probabilities in [0, 1]. Defaults to the quartiles c(0, 0.25, 0.5, 0.75, 1).

under_h1

Logical. If TRUE (default) quantiles are taken under H_1 (weights p_h1); if FALSE, under H_2 (weights p_h2).

...

Unused.

Details

Atoms with zero mass under the requested hypothesis are dropped before the cumulative distribution is formed. A +Inf (or -Inf) atom is a legitimate quantile value when the requested probability falls in its mass. An error is raised if no atom has positive mass under the requested hypothesis.

Value

A named numeric vector of quantiles, one per probs entry.

See Also

lr_distribution(), summary.lr_dist(), plot.lr_dist()

Examples

d <- as_lr_dist(data.frame(
  log10_lr = c(-1, 0, 2),
  p_h1 = c(0.1, 0.3, 0.6),
  p_h2 = c(0.6, 0.3, 0.1)
))
quantile(d)
quantile(d, probs = c(0.05, 0.95), under_h1 = FALSE)

mispitools documentation built on Aug. 26, 2026, 1:08 a.m.