Title: | Calibration of P-Values for Point Null Hypotheses |
---|---|
Description: | Calibrate p-values under a robust perspective using the methods developed by Sellke, Bayarri, and Berger (2001) <doi:10.1198/000313001300339950> and obtain measures of the evidence provided by the data in favor of point null hypotheses which are safer and more straightforward to interpret. |
Authors: | Pedro Fonseca [aut, cre] , Rui Paulo [ctb, ths] , FCT [fnd] |
Maintainer: | Pedro Fonseca <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.1.0 |
Built: | 2024-10-18 04:00:17 UTC |
Source: | https://github.com/pedro-teles-fonseca/pcal |
Calibrate p-values under a robust Bayesian perspective so that they can be directly interpreted as lower bounds on Bayes factors in favor of point null hypotheses.
bcal(p)
bcal(p)
p |
A numeric vector with values in the [0,1] interval. |
bcal
is a vectorized implementation of the calibration of
p-values into lower bounds for Bayes factors developed by
Sellke et al. (2001). The calibration is:
for ,
where
is a p-value on a classical test statistic, and
otherwise.
should be interpreted as an
approximation to the lower bound of the Bayes factor (in favor of the null
hypothesis) that is found by changing the prior distribution of the parameter
of interest (under the alternative hypothesis) over wide classes of
distributions.
Sellke et al. (2001) noted that a scenario in which they definitely recommend this calibration is when investigating fit to the null model/hypothesis with no explicit alternative in mind. Pericchi and Torres (2011) warn that despite the usefulness and appropriateness of this p-value calibration it does not depend on sample size and hence the lower bounds obtained with large samples may be conservative.
bcal
returns a numeric vector with the same
length
as p
. A warning message is thrown if there are
NA
or NaN
values in p
.
Pericchi L, Torres D (2011).
“Quick anomaly detection by the Newcomb—Benford law, with applications to electoral processes data from the USA, Puerto Rico and Venezuela.”
Statistical Science, 26(4), 502–516.
Sellke T, Bayarri MJ, Berger JO (2001).
“Calibration of p values for testing precise null hypotheses.”
The American Statistician, 55(1), 62–71.
bfactor_interpret
for the interpretation of Bayes
factors.
bfactor_to_prob
to turn Bayes factors into posterior
probabilities.
pcal
for a p-value calibration that returns lower
bounds for the posterior probabilities of point null hypotheses.
# Calibration of a typical "threshold" p-value: # ---------------------------------------------------------------- bcal(.05) # Calibration of typical "threshold" p-values: # ---------------------------------------------------------------- bcal(c(.1, .05, .01, .005, .001)) # Application: chi-squared goodness-of-fit test, # lower bound on the Bayes factor in favor of the null hypothesis: # ---------------------------------------------------------------- data <- matrix(c(18, 12, 10, 12, 10, 23), ncol = 2) bcal(chisq.test(data)[["p.value"]])
# Calibration of a typical "threshold" p-value: # ---------------------------------------------------------------- bcal(.05) # Calibration of typical "threshold" p-values: # ---------------------------------------------------------------- bcal(c(.1, .05, .01, .005, .001)) # Application: chi-squared goodness-of-fit test, # lower bound on the Bayes factor in favor of the null hypothesis: # ---------------------------------------------------------------- data <- matrix(c(18, 12, 10, 12, 10, 23), ncol = 2) bcal(chisq.test(data)[["p.value"]])
Quantify the strength of the evidence provided by the data to a model/hypothesis according to Bayes factor interpretation scales suggested by Jeffreys (1961) and Kass and Raftery (1995).
bfactor_interpret(bf, scale = "jeffreys")
bfactor_interpret(bf, scale = "jeffreys")
bf |
A numeric vector of non-negative values. |
scale |
A string of characters specifying either "jeffreys" or "kass-raftery". Not case sensitive. |
Bayes factors are a summary of the evidence provided by the data to a model/hypothesis. Jeffreys (1961) suggested the interpretation of Bayes factors in half-units on the base 10 logarithmic scale, as indicated in the following table:
log10(Bayes factor) | Bayes factor | Evidence |
[-Inf, 0[ | [0, 1[ | Negative |
[0, 0.5[ | [1, 3.2[ | Weak |
[0.5, 1[ | [3.2, 10[ | Substantial |
[1, 1.5[ | [10, 32[ | Strong |
[1.5, 2[ | [32, 100[ | Very Strong |
[2, +Inf[ | [100, +Inf[ | Decisive |
By default, bfactor_interpret
takes Bayes factors as input and returns the strength of the evidence in favor of the model/hypothesis in the numerator of the Bayes factors (usually the null hypothesis) according to the aforementioned table.
Alternatively, and because it can be useful to consider twice the natural logarithm of the Bayes factor (which is in the same scale as the familiar deviance and likelihood ratio test statistics), Kass and Raftery (1995) suggested the following scale:
2*log(Bayes factor) | Bayes factor | Evidence |
[-Inf, 0[ | [0, 1[ | Negative |
[0, 2[ | [1, 3[ | Weak |
[2, 6[ | [3, 20[ | Positive |
[6, 10[ | [20, 150[ | Strong |
[10, +Inf[ | [150, +Inf[ | Very Strong |
To interpret Bayes factors according to the latter table use scale = "kass-raftery"
.
When comparing Bayes factors with results from standard likelihood ratio tests it is convenient to put the null hypothesis in the denominator of the Bayes factor so that bfactor_interpret
returns the strength of the evidence against the null hypothesis. If bf
was obtained with the null hypothesis on the numerator, one can use bfactor_interpret(1/bf)
or bfactor_interpret(1/bf, scale = "kass-raftery")
to obtain the strength of the evidence against the null hypothesis.
Returns a character vector with the same length as bf
.
Jeffreys H (1961).
Theory of probability, Oxford Classic Texts In The Physical Sciences, 3 edition.
Oxford University Press.
Kass RE, Raftery AE (1995).
“Bayes factors.”
Journal of the American Statistical Association, 90(430), 773–795.
bfactor_log_interpret
for the interpretation of the logarithms of Bayes factors.
bfactor_to_prob
to turn Bayes factors into posterior probabilities.
bcal
for a p-value calibration that returns lower bounds on Bayes factors in favor of point null hypotheses.
# Interpretation of one Bayes factor bfactor_interpret(4) bfactor_interpret(4, scale = "jeffreys") bfactor_interpret(4, scale = "kass-raftery") # Interpretation of more than one Bayes factors bfactor_interpret(c(0.1, 1.2, 3.5, 13.9, 150)) bfactor_interpret(c(0.1, 1.2, 3.5, 13.9, 150), scale = "jeffreys") bfactor_interpret(c(0.1, 1.2, 3.5, 13.9, 150), scale = "kass-raftery") # Application: chi-squared goodness-of-fit test. # Strength of the evidence provided by the lower # bound of the Bayes factor in favor of the null hypothesis: data <- matrix(c(18, 12, 10, 12, 10, 23), ncol = 2) bfactor_interpret(bcal(chisq.test(data)[["p.value"]]))
# Interpretation of one Bayes factor bfactor_interpret(4) bfactor_interpret(4, scale = "jeffreys") bfactor_interpret(4, scale = "kass-raftery") # Interpretation of more than one Bayes factors bfactor_interpret(c(0.1, 1.2, 3.5, 13.9, 150)) bfactor_interpret(c(0.1, 1.2, 3.5, 13.9, 150), scale = "jeffreys") bfactor_interpret(c(0.1, 1.2, 3.5, 13.9, 150), scale = "kass-raftery") # Application: chi-squared goodness-of-fit test. # Strength of the evidence provided by the lower # bound of the Bayes factor in favor of the null hypothesis: data <- matrix(c(18, 12, 10, 12, 10, 23), ncol = 2) bfactor_interpret(bcal(chisq.test(data)[["p.value"]]))
Quantify the strength of the evidence provided by the data to a model/hypothesis according a Bayes factor interpretation scale suggested by Kass and Raftery (1995).
bfactor_interpret_kr(bf)
bfactor_interpret_kr(bf)
bf |
A numeric vector of non-negative values. |
Bayes factors are a summary of the evidence provided by the data to a model/hypothesis. Because it can be useful to consider twice the natural logarithm of the Bayes factor, which is in the same scale as the familiar deviance and likelihood ratio test statistics, Kass and Raftery (1995) suggested the following Bayes factor interpretation scale:
2*log(Bayes factor) | Bayes factor | Evidence |
[-Inf, 0[ | [0, 1[ | Negative |
[0, 2[ | [1, 3[ | Weak |
[2, 6[ | [3, 20[ | Positive |
[6, 10[ | [20, 150[ | Strong |
[10, +Inf[ | [150, +Inf[ | Very strong |
bfactor_interpret_kr
takes Bayes factors as input and returns the strength of the evidence in favor of the model/hypothesis in the numerator of the Bayes factors (usually the null hypothesis) according to the aforementioned table.
When comparing results with those from standard likelihood ratio tests, it is convenient to put the null hypothesis in the denominator of the Bayes factor so that bfactor_interpret_kr
returns the strength of the evidence against the null hypothesis. If bf
was obtained with the null hypothesis on the numerator, one can use bfactor_interpret_kr(1/bf)
to obtain the strength of the evidence against the null hypothesis.
Returns a character vector with the same length
as bf
.
Kass RE, Raftery AE (1995). “Bayes factors.” Journal of the American Statistical Association, 90(430), 773–795.
bfactor_interpret
for the original interpretation scale suggested by Harold Jeffreys.
bfactor_log_interpret
and bfactor_log_interpret_kr
for the interpretation of the logarithms of Bayes factors.
bfactor_to_prob
to turn Bayes factors into posterior probabilities.
bcal
for a p-value calibration that returns lower bounds on Bayes factors in favor of point null hypotheses.
# Interpretation of one Bayes factor bfactor_interpret_kr(1.5) # Interpretation of many Bayes factors bfactor_interpret_kr(c(0.1, 1.2, 3.5, 13.9, 150)) # Application: chi-squared goodness-of-fit test. # Strength of the evidence provided by the lower # bound on the Bayes factor in favor of the null hypothesis: x <- matrix(c(12, 15, 14, 15), ncol = 2) bfactor_interpret_kr(bcal(chisq.test(x)[["p.value"]]))
# Interpretation of one Bayes factor bfactor_interpret_kr(1.5) # Interpretation of many Bayes factors bfactor_interpret_kr(c(0.1, 1.2, 3.5, 13.9, 150)) # Application: chi-squared goodness-of-fit test. # Strength of the evidence provided by the lower # bound on the Bayes factor in favor of the null hypothesis: x <- matrix(c(12, 15, 14, 15), ncol = 2) bfactor_interpret_kr(bcal(chisq.test(x)[["p.value"]]))
Quantify the strength of the evidence provided by the data to a model/hypothesis according to Bayes factor interpretation scales suggested by Jeffreys (1961) and Kass and Raftery (1995).
bfactor_log_interpret(bf, scale = "jeffreys", base = exp(1))
bfactor_log_interpret(bf, scale = "jeffreys", base = exp(1))
bf |
A numeric vector. |
scale |
A string of characters specifying either "jeffreys" or "kass-raftery". Not case sensitive. |
base |
A numeric vector of |
Bayes factors are a summary of the evidence provided by the data to a model/hypothesis, and are often reported on a logarithmic scale. Jeffreys (1961) suggested the interpretation of Bayes factors in half-units on the base 10 logarithmic scale, as indicated in the following table:
log10(Bayes factor) | Bayes factor | Evidence |
[-Inf, 0[ | [0, 1[ | Negative |
[0, 0.5[ | [1, 3.2[ | Weak |
[0.5, 1[ | [3.2, 10[ | Substantial |
[1, 1.5[ | [10, 32[ | Strong |
[1.5, 2[ | [32, 100[ | Very Strong |
[2, +Inf[ | [100, +Inf[ | Decisive |
By default, bfactor_log_interpret
takes (base base
) logarithms of Bayes factors as input and returns the strength of the evidence in favor of the model/hypothesis in the numerator of the Bayes factors (usually the null hypothesis) according to the aforementioned table.
Alternatively, and because it can be useful to consider twice the natural logarithm of the Bayes factor (which is in the same scale as the familiar deviance and likelihood ratio test statistics), Kass and Raftery (1995) suggested the following scale:
2*log(Bayes factor) | Bayes factor | Evidence |
[-Inf, 0[ | [0, 1[ | Negative |
[0, 2[ | [1, 3[ | Weak |
[2, 6[ | [3, 20[ | Positive |
[6, 10[ | [20, 150[ | Strong |
[10, +Inf[ | [150, +Inf[ | Very Strong |
To interpret base base
logarithms of Bayes factors according to the latter table use scale = "kass-raftery"
.
When comparing Bayes factors with results from standard likelihood ratio tests it is convenient to put the null hypothesis in the denominator of the Bayes factor so that bfactor_log_interpret
returns the strength of the evidence against the null hypothesis. If bf
was obtained with the null hypothesis on the numerator, one can use bfactor_log_interpret(1/bf)
or bfactor_log_interpret(1/bf, scale = "kass-raftery")
to obtain the strength of the evidence against the null hypothesis.
Returns a character vector with the same length
as bf
.
Jeffreys H (1961).
Theory of probability, Oxford Classic Texts In The Physical Sciences, 3 edition.
Oxford University Press.
Kass RE, Raftery AE (1995).
“Bayes factors.”
Journal of the American Statistical Association, 90(430), 773–795.
bfactor_interpret
for the interpretation of Bayes factors in levels.
bfactor_to_prob
to turn Bayes factors into posterior probabilities.
bcal
for a p-value calibration that returns lower bounds on Bayes factors in favor of point null hypotheses.
# Interpretation of the natural log of a Bayes factors bfactor_log_interpret(log(1.5)) bfactor_log_interpret(log(1.5), scale = "jeffreys") bfactor_log_interpret(log(1.5), scale = "kass-raftery") # Interpretation of the natural log of many Bayes factors bfactor_log_interpret(log(c(0.1, 1.2, 3.5, 13.9, 150))) bfactor_log_interpret(log(c(0.1, 1.2, 3.5, 13.9, 150)), scale = "kass-raftery") # Interpretation of the base-10 log of many Bayes factors bfactor_log_interpret(log10(c(0.1, 1.2, 3.5, 13.9, 150)), base = 10) bfactor_log_interpret(log10(c(0.1, 1.2, 3.5, 13.9, 150)), base = 10, scale = "kass-raftery")
# Interpretation of the natural log of a Bayes factors bfactor_log_interpret(log(1.5)) bfactor_log_interpret(log(1.5), scale = "jeffreys") bfactor_log_interpret(log(1.5), scale = "kass-raftery") # Interpretation of the natural log of many Bayes factors bfactor_log_interpret(log(c(0.1, 1.2, 3.5, 13.9, 150))) bfactor_log_interpret(log(c(0.1, 1.2, 3.5, 13.9, 150)), scale = "kass-raftery") # Interpretation of the base-10 log of many Bayes factors bfactor_log_interpret(log10(c(0.1, 1.2, 3.5, 13.9, 150)), base = 10) bfactor_log_interpret(log10(c(0.1, 1.2, 3.5, 13.9, 150)), base = 10, scale = "kass-raftery")
Quantify the strength of the evidence provided by the data to a model/hypothesis according a Bayes factor interpretation scale suggested by Kass and Raftery (1995).
bfactor_log_interpret_kr(bf, base = exp(1))
bfactor_log_interpret_kr(bf, base = exp(1))
bf |
A numeric vector. |
base |
A numeric vector of |
Bayes factors are a summary of the evidence provided by the data to a model/hypothesis, and are often reported on a logarithmic scale. Because it can be useful to consider twice the natural logarithm of the Bayes factor, which is in the same scale as the familiar deviance and likelihood ratio test statistics, Kass and Raftery (1995) suggested the following Bayes factor interpretation scale:
2*log(Bayes factor) | Bayes factor | Evidence |
[-Inf, 0[ | [0, 1[ | Negative |
[0, 2[ | [1, 3[ | Weak |
[2, 6[ | [3, 20[ | Positive |
[6, 10[ | [20, 150[ | Strong |
[10, +Inf[ | [150, +Inf[ | Very strong |
bfactor_log_interpret_kr
takes (base base
) logarithms of Bayes factors as input and returns the strength of the evidence provided by the data in favor of the model/hypothesis in the numerator of the Bayes factors (usually the null hypothesis) according to the aforementioned table.
When comparing results with those from standard likelihood ratio tests, it is convenient to put the null hypothesis in the denominator of the Bayes factor so that bfactor_log_interpret_kr
returns the strength of the evidence against the null hypothesis. If bf
was obtained with the null hypothesis on the numerator, one can use bfactor_log_interpret_kr(1/bf)
to obtain the strength of the evidence against the null hypothesis.
Returns a character vector with the same length as bf
.
Kass RE, Raftery AE (1995). “Bayes factors.” Journal of the American Statistical Association, 90(430), 773–795.
bfactor_log_interpret
for the original interpretation scale suggested by Harold Jeffreys
bfactor_interpret
and bfactor_interpret_kr
for the interpretation of Bayes factors in levels.
bfactor_to_prob
to turn Bayes factors into posterior probabilities.
bcal
for a p-value calibration that returns lower bounds on Bayes factors in favor of point null hypotheses.
# Interpretation of one Bayes factor, natural log bfactor_log_interpret_kr(1.5) # Interpretation of many Bayes factors, natural log bfactor_log_interpret_kr(c(0.1, 1.2, 3.5, 13.9, 150)) # Interpretation of many Bayes factors, base 10 log bfactor_log_interpret_kr(log10(c(0.1, 1.2, 3.5, 13.9, 150)), base = 10)
# Interpretation of one Bayes factor, natural log bfactor_log_interpret_kr(1.5) # Interpretation of many Bayes factors, natural log bfactor_log_interpret_kr(c(0.1, 1.2, 3.5, 13.9, 150)) # Interpretation of many Bayes factors, base 10 log bfactor_log_interpret_kr(log10(c(0.1, 1.2, 3.5, 13.9, 150)), base = 10)
Update prior probabilities of models/hypotheses to posterior probabilities using Bayes factors.
bfactor_to_prob(bf, prior_prob = 0.5)
bfactor_to_prob(bf, prior_prob = 0.5)
bf |
A numeric vector of non-negative values. |
prior_prob |
A numeric vector with values in the [0,1] interval.
If |
bfactor_to_prob
turns Bayes factors into posterior
probabilities using a vectorized version of the following
equation from Berger and Delampady (1987):
where is a Bayes factor in favor of the null
hypothesis (given the data
),
is the prior
probability of the null hypothesis and
is the prior probability of the alternative hypothesis.
If bf
is a vector of Bayes factors (in favor of the null hypothesis)
and prior_prob
is a vector with the prior probabilities of those
hypotheses then bfactor_to_prob(bf, prior_prob)
updates prior_prob
to posterior probabilities. The posterior probabilities of the alternative
hypotheses can be obtained with 1 - bfactor_to_prob(bf, prior_prob)
.
The prior_prob
argument is optional and is set to 0.5 by default,
implying prior equiprobability of hypotheses. prior_prob
can only
be of length
equal to length(bf)
, in which case
each prior probability in prior_prob
will be updated using the
corresponding element of bf
, or of length
1
,
in which case it will be recycled (if length(bf) > 1
) and each
element of bf
will update the same prior_prob
value.
If length(bf) > 1
then bfactor_to_prob
returns a numeric
vector with the same length
as bf
, otherwise it
returns a numeric vector with the same length
as
prior_prob
. Warning messages are thrown if there are NA
or NaN
values in bf
or in prior_prob
.
Berger JO, Delampady M (1987). “Testing precise hypotheses.” Statistical Science, 2(3), 317–335.
bfactor_interpret
for the interpretation of
Bayes factors.
# With a Bayes factor that is indifferent between the null # and the alternative hypotheses: # -------------------------------------------------------- bfactor_to_prob(1) # Same as above but the null hypothesis has high prior probability: # ----------------------------------------------------------------- bfactor_to_prob(1, .99) # Posterior probability of the null hypothesis as a function # of the prior probability: # ----------------------------------------------------------------- bfactor_to_prob(1, seq(.5, 1, .1)) # With Bayes factors that favor the null hypothesis: # ----------------------------------------------------------------- round(bfactor_to_prob(seq(2, 50, 2.5)), 3) # Same as above but the null hypothesis has low prior probability: # ----------------------------------------------------------------- round(bfactor_to_prob(seq(2, 50, 2.5), prior_prob = .01), 3) # Posterior probabilities obtained with Bayes factors that # favor the alternative hypothesis: # ----------------------------------------------------------------- round(bfactor_to_prob(seq(0, 1, .05)), 3) # Same as above but the null hypothesis has high prior probability: # ----------------------------------------------------------------- round(bfactor_to_prob(seq(0, 1, .05), prior_prob = .99), 3) # Application: chi-squared goodness-of-fit test, # lower bound on the posterior probability of the null hypothesis: # ----------------------------------------------------------------- x <- matrix(c(12, 41, 25, 33), ncol = 2) bfactor_to_prob(bcal(chisq.test(x)[["p.value"]]), prior_prob = .9)
# With a Bayes factor that is indifferent between the null # and the alternative hypotheses: # -------------------------------------------------------- bfactor_to_prob(1) # Same as above but the null hypothesis has high prior probability: # ----------------------------------------------------------------- bfactor_to_prob(1, .99) # Posterior probability of the null hypothesis as a function # of the prior probability: # ----------------------------------------------------------------- bfactor_to_prob(1, seq(.5, 1, .1)) # With Bayes factors that favor the null hypothesis: # ----------------------------------------------------------------- round(bfactor_to_prob(seq(2, 50, 2.5)), 3) # Same as above but the null hypothesis has low prior probability: # ----------------------------------------------------------------- round(bfactor_to_prob(seq(2, 50, 2.5), prior_prob = .01), 3) # Posterior probabilities obtained with Bayes factors that # favor the alternative hypothesis: # ----------------------------------------------------------------- round(bfactor_to_prob(seq(0, 1, .05)), 3) # Same as above but the null hypothesis has high prior probability: # ----------------------------------------------------------------- round(bfactor_to_prob(seq(0, 1, .05), prior_prob = .99), 3) # Application: chi-squared goodness-of-fit test, # lower bound on the posterior probability of the null hypothesis: # ----------------------------------------------------------------- x <- matrix(c(12, 41, 25, 33), ncol = 2) bfactor_to_prob(bcal(chisq.test(x)[["p.value"]]), prior_prob = .9)
Calibrate p-values under a robust perspective so that they can be directly interpreted as either lower bounds on the posterior probabilities of point null hypotheses or lower bounds on the probabilities of type I errors.
pcal(p, prior_prob = 0.5)
pcal(p, prior_prob = 0.5)
p |
A numeric vector with values in the [0,1] interval. |
prior_prob |
A numeric vector with values in the [0,1] interval.
If |
pcal
is a vectorized implementation of the calibration of p-values
into lower bounds for the posterior probabilities of point null hypotheses
(or lower bounds for the probabilities of type I errors) developed by
Sellke et al. (2001). The calibration is:
where is a p-value on a classical test statistic. This
calibration assumes that both the null and the alternative hypotheses have
0.5 prior probability. We generalized the aforementioned calibration for
prior probabilities other than 0.5:
where is the prior probability of the null hypothesis
and
is the prior probability of the alternative
hypothesis.
For each element of p
, pcal
returns an approximation of the smallest
posterior probability of the null hypothesis that is found by changing the
prior distribution of the parameter of interest (under the alternative
hypothesis) over wide classes of distributions. Alternatively, the output
of pcal
can also be interpreted as lower bounds on the probabilities of
type I errors, which means that this calibration has both Bayesian and
Frequentist interpretations. Sellke et al. (2001)
noted that a scenario in which they definitely recommend this calibration
is when investigating fit to the null model with no explicit alternative
in mind. Pericchi and Torres (2011) warn that despite
the usefulness and appropriateness of this p-value calibration it does not
depend on sample size, and hence the lower bounds obtained with large
samples may be conservative.
The prior_prob
argument is optional and is set to 0.5 by default,
implying prior equiprobability of hypotheses. prior_prob
can only be
of length
equal to the length
of p
, in which
case each prior probability in prior_prob
is used in the calibration
of the corresponding element of p
, or of length
1
,
in which case it will be recycled (if length(p) > 1
) and the same
prior_prob
value is used in the calibration of all the elements of p
.
Note that pcal(p, prior_prob)
is equivalent to
bfactor_to_prob(bcal(p), prior_prob)
.
If length(p) > 1
then pcal
returns a numeric vector
with the same length
as p
, otherwise it returns
a numeric vector with the same length
as prior_prob
.
Warning messages are thrown if there are NA
or NaN
values in p
or in prior_prob
.
Pericchi L, Torres D (2011).
“Quick anomaly detection by the Newcomb—Benford law, with applications to electoral processes data from the USA, Puerto Rico and Venezuela.”
Statistical Science, 26(4), 502–516.
Sellke T, Bayarri MJ, Berger JO (2001).
“Calibration of p values for testing precise null hypotheses.”
The American Statistician, 55(1), 62–71.
bcal
for a p-value calibration that returns lower
bounds on Bayes factors in favor of point null hypotheses.
# Calibration of a typical "threshold" p-value: # ---------------------------------------------------------------- pcal(.05) # Calibration of typical "threshold" p-values: # ---------------------------------------------------------------- pcal(c(.1, .05, .01, .005, .001)) # Application: chi-squared goodness-of-fit test, # lower bound on the posterior probability of the null hypothesis: # ---------------------------------------------------------------- data <- matrix(c(18, 12, 10, 12, 10, 23), ncol = 2) pcal(chisq.test(data)[["p.value"]])
# Calibration of a typical "threshold" p-value: # ---------------------------------------------------------------- pcal(.05) # Calibration of typical "threshold" p-values: # ---------------------------------------------------------------- pcal(c(.1, .05, .01, .005, .001)) # Application: chi-squared goodness-of-fit test, # lower bound on the posterior probability of the null hypothesis: # ---------------------------------------------------------------- data <- matrix(c(18, 12, 10, 12, 10, 23), ncol = 2) pcal(chisq.test(data)[["p.value"]])