| pvalue | R Documentation |
A Bayesian p-value (p) is here defined in terms of the quantile-based (1-p) * 100% credible interval (CRI) that just includes a threshold (Kery and Schaub 2011).
pvalue(x, ..., side = "both", threshold = 0, skeptical = TRUE, na_rm = FALSE)
x |
A numeric vector of MCMC values. |
... |
Unused. |
side |
A character vector of length 1 indicating whether to calculate
p-values for the left tail ( |
threshold |
A number of the threshold value. |
skeptical |
A flag specifying whether or not to add one sample to the empty side of the threshold when 100% of samples are on one side. Avoids zero p-values and infinite s-values, and also imposes stronger bounds on directional information than [-n, n], which assume the MCMC samples are independent and representative. |
na_rm |
A flag specifying whether to remove missing values. |
A p-value of 0.05 indicates that the 95% CRI just includes the threshold value.
Note that the function contains the sample-size correction
p_{c} = p * n / (n + 1) to avoid p-values of 0. The function can still
return p-values of 1.
When skeptical = TRUE (default), a floor of 1 / (n + 1) is applied
to avoid p-values of 0 when all samples are on one side of the threshold.
When skeptical = FALSE, p-values of 0 are allowed.
To use as a measure of certainty in the direction of the estimate (i.e.,
positive or negative), see probability_direction().
For p-values converted to bits, see svalue().
To convert MCMC objects to information, see directional_information().
A number between 0 and 1.
If x has NA values but na_rm is FALSE, returns NA_real.
Kery, M., and Schaub, M. 2011. Bayesian population analysis using WinBUGS: a hierarchical perspective. Academic Press, Boston. Available from https://www.vogelwarte.ch/en/research/population-biology/book-bpa/.
Other summary:
direction(),
directional_information(),
kurtosis(),
lower(),
probability_direction(),
pzeros(),
skewness(),
svalue(),
upper(),
variance(),
xtr_mean(),
xtr_median(),
xtr_sd(),
zeros(),
zscore()
x <- rnorm(1e6, qnorm(0.05, lower.tail = TRUE))
pvalue(x) # should be 0.05 * 2
pvalue(x, side = "left") # should be 0.95
pvalue(x, side = "right") # should be 0.05
pvalue(rep(1, 10)) # skeptical = TRUE (default) avoids p = 0
pvalue(rep(1, 10), skeptical = FALSE) # skeptical = FALSE allows p = 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.