abc_prior S3 class
Arguments
- .dists
distribution functions as a named list of S3
dist_fnsobjects- .constraints
a list of one sided formulae the result each of which should evaluate to a boolean when compared against the names of the priors and derived values.
- .derived
a list of two sided formulae. The RHS refer to the priors, and the LHS as a name to derive.
- .cor
(optional) a correlation matrix for the priors
- x
an
abc_priorS3 object- ...
passed on to methods
Value
an S3 object of class abc_prior which contains
a list of
dist_fnsa
corattribute describing their correlationa
derivedattribute describing derive valuesa
constraintsattribute listing the constraintsa
paramsattribute listing the names of the parameters
Methods (by generic)
format(abc_prior): Format anabc_priorprint(abc_prior): Print anabc_priorplot(abc_prior): Plot anabc_prior
Functions
new_abc_prior(): Create a new prioras.abc_prior(): Create a prior from a named list ofdist_fnsis.abc_prior(): Test is anabc_prior
Unit tests
p = new_abc_prior(
.dists = list(
mean = as.dist_fns("norm",4,2),
sd = as.dist_fns("gamma",2)
),
.derived = list(
shape ~ mean^2 / sd^2,
rate ~ mean / sd^2
),
.constraints = list(
~ mean > sd
)
)
testthat::expect_equal(
format(p),
"Parameters: \n* mean: norm(mean = 4, sd = 2)\n* sd: gamma(shape = 2, rate = 1)\nConstraints:\n* mean > sd\nDerived values:\n* shape = mean^2/sd^2\n* rate = mean/sd^2"
)