Learn R Programming

parameters (version 0.22.0)

p_calibrate: Calculate calibrated p-values.

Description

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).

Usage

p_calibrate(x, ...)

# S3 method for default p_calibrate(x, type = "frequentist", verbose = TRUE, ...)

Value

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

Arguments

x

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

...

Currently not used.

type

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

verbose

Toggle warnings.

Details

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.

References

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, tools:::Rd_expr_doi("10.1198/000313001300339950")

Examples

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

Run the code above in your browser using DataLab