Computes variance of a prior distribution.
# S3 method for class 'prior'
var(x, ...)a variance of an object of class 'prior'.
The variance of a truncated normal prior is computed in closed
form. Its terms cancel far in a tail and for narrow truncation intervals,
so the variance is returned only when its estimated relative rounding error
in double precision is at most 1e-6; otherwise the function stops with an
error. For a one-sided truncation, the error is raised beyond about 33
prior standard deviations from the mean. The same applies to sd()
and to spike-and-slab priors with such a slab. The variance can then be
estimated from rng() draws of the prior, which sample the truncated
distribution exactly, subject to Monte Carlo error. The variance of any
other truncated prior is the integral of the squared deviation of its
truncated quantile function from the mean over the probability interval
(0, 1), non-negative by construction; it is refused with
BayesTools_numerical_unavailable when the quantile function is
unavailable or the integral's estimated error exceeds 1e-6 of the variance.