| directional_information | R Documentation |
The occurrence of an event (or lack thereof) transmits more or less information depending on the event's probability.
directional_information(
x,
...,
side = "median",
threshold = 0,
threshold_split = "proportional",
skeptical = TRUE,
na_rm = FALSE
)
p2info(p, n = Inf)
x |
A numeric vector of MCMC values. |
... |
Unused. |
side |
A string indicating whether to calculate
the directional information relative to the left side ( |
threshold |
A number of the threshold value. |
threshold_split |
A string indicating how to deal with threshold values:
|
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. |
p |
A numeric vector of probabilities of direction. |
n |
A numeric vector of the number of posterior samples used to estimate
each value of |
Quantifies the information about direction in a posterior distribution based on the directional probability.
This function calculates such information using the difference in the probability of direction (see probability_direction()), after converting each probability to bits (also see svalue().
When skeptical = TRUE (default), one sample is added to the empty side,
giving bounds of \pm \log_2(n) rather than \pm n, to mimic the
behaviour of pvalue() and svalue().
When skeptical = FALSE, information is instead clamped to [-n, n],
which is assumes the MCMC samples are independent and representative.
A number indicating the directional information in bits.
If x has NA values but na_rm is FALSE, returns NA_real.
directional_information(): Calculate the directional information from a posterior distribution.
p2info(): Calculate the information from a vector of probabilities.
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(),
kurtosis(),
lower(),
probability_direction(),
pvalue(),
pzeros(),
skewness(),
svalue(),
upper(),
variance(),
xtr_mean(),
xtr_median(),
xtr_sd(),
zeros(),
zscore()
directional_information(0)
directional_information(1) # one coin flip of information
directional_information(c(1, 1)) # two coin flips
directional_information(c(1, 1, -1)) # x[2] and x[3] cancel out
directional_information(c(1, 1, -1, -1)) # both sides cancel out
directional_information(rnorm(1e3, mean = 0))
directional_information(rnorm(1e3, mean = 1))
directional_information(rnorm(1e3, mean = 10)) # all coin flips are positive
directional_information(rnorm(1e3, mean = -10)) # all coin flips are negative
directional_information(rnorm(1e3, mean = 1e3)) # only quantiles matter
directional_information(rnorm(1e6, mean = 1e3)) # more `x` implies more info
directional_information(rep(1, 1000)) # skeptical = TRUE (default) gives log2(n)
directional_information(rep(1, 1000), skeptical = FALSE) # skeptical = FALSE gives n
p2info(seq(0, 1, by = 0.1))
p2info(seq(0, 1, by = 0.1), n = 10) # limit information to be in [-10, 10]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.