p_calibrate: Calculate calibrated p-values.

View source: R/p_calibrate.R

p_calibrateR Documentation

Calculate calibrated p-values.


Compute calibrated p-values that can be interpreted probabilistically, i.e. as posterior probability of H0 (given that H0 and H1 have equal prior probabilities).


p_calibrate(x, ...)

## Default S3 method:
p_calibrate(x, type = "frequentist", verbose = TRUE, ...)



A numeric vector of p-values, or a regression model object.


Currently not used.


Type of calibration. Can be "frequentist" or "bayesian". See 'Details'.


Toggle warnings.


The Bayesian calibration, i.e. when type = "bayesian", can be interpreted as the lower bound of the Bayes factor for H0 to H1, based on the data. The full Bayes factor would then require multiplying by the prior odds of H0 to H1. The frequentist calibration also has a Bayesian interpretation; it is the posterior probability of H0, assuming that H0 and H1 have equal prior probabilities of 0.5 each (Sellke et al. 2001).

The calibration only works for p-values lower than or equal to 1/e.


A data frame with p-values and calibrated p-values.


Thomas Sellke, M. J Bayarri and James O Berger (2001) Calibration of p Values for Testing Precise Null Hypotheses, The American Statistician, 55:1, 62-71, doi: 10.1198/000313001300339950


model <- lm(mpg ~ wt + as.factor(gear) + am, data = mtcars)
p_calibrate(model, verbose = FALSE)

parameters documentation built on Jan. 11, 2023, 5:16 p.m.