Precision {LaplacesDemon} | R Documentation |
Precision
Description
Bayesians often use precision rather than variance. These are elementary
utility functions to facilitate conversions between precision,
standard deviation, and variance regarding scalars, vectors, and
matrices, and these functions are designed for those who are new to
Bayesian inference. The names of these functions consist of two
different scale parameters, separated by a ‘2’, and capital letters
refer to matrices while lower case letters refer to scalars and
vectors. For example, the Prec2Cov
function converts a
precision matrix to a covariance matrix, while the prec2sd
function converts a scalar or vector of precision parameters to
standard deviation parameters.
The modern Bayesian use of precision developed because it was more
straightforward in a normal distribution to estimate precision
\tau
with a gamma distribution as a conjugate prior, than
to estimate \sigma^2
with an inverse-gamma distribution
as a conjugate prior. Today, conjugacy is usually considered to be
merely a convenience, and in this example, a non-conjugate half-Cauchy
prior distribution is recommended as a weakly informative prior
distribution for scale parameters.
Usage
Cov2Prec(Cov)
Prec2Cov(Prec)
prec2sd(prec=1)
prec2var(prec=1)
sd2prec(sd=1)
sd2var(sd=1)
var2prec(var=1)
var2sd(var=1)
Arguments
Cov |
This is a covariance matrix, usually represented as
|
Prec |
This is a precision matrix, usually represented as
|
prec |
This is a precision scalar or vector, usually represented as
|
sd |
This is a standard deviation scalar or vector, usually
represented as |
var |
This is a variance scalar or vector, usually
represented as |
Details
Bayesians often use precision rather than variance, where
precision is the inverse of the variance. For example, a linear
regression may be represented equivalently as \textbf{y} \sim
\mathcal{N}(\mu, \sigma^2)
, or \textbf{y}
\sim \mathcal{N}(\mu, \tau^{-1})
, where
\sigma^2
is the variance, and \tau
is the
precision, which is the inverse of the variance.
Value
Cov2Prec |
This returns a precision matrix, |
Prec2Cov |
This returns a covariance matrix, |
prec2sd |
This returns a standard deviation, |
prec2var |
This returns a variance, |
sd2prec |
This returns a precision, |
sd2var |
This returns a variance, |
var2prec |
This returns a precision, |
var2sd |
This returns a standard deviation, |
Author(s)
Statisticat, LLC. software@bayesian-inference.com
See Also
Examples
library(LaplacesDemon)
Cov2Prec(matrix(c(1,0.1,0.1,1),2,2))
Prec2Cov(matrix(c(1,0.1,0.1,1),2,2))
prec2sd(0.5)
prec2var(0.5)
sd2prec(1.4142)
sd2var(01.4142)
var2prec(2)
var2sd(2)