This function estimates the probability that a vector of posterior draws,
represented by the parameter eta
, falls within a specified range.
It provides flexibility to use either prior distributions or posterior draws,
and to specify one-sided or two-sided probability calculations.
calcProb(x, a = NULL, b = NULL, prior = FALSE, group_name = "group average")
A formatted string stating the calculated probability and the specified range. The probability is the proportion of samples (either prior or posterior) that fall within the defined range.
A numeric vector containing either posterior draws (default)
or prior samples of the treatment effect parameter (eta
).
(Optional) The lower bound of the range (as a proportion, not percentage).
(Optional) The upper bound of the range (as a proportion, not percentage).
A logical value indicating whether to use prior samples (TRUE
)
or posterior draws (FALSE
, default) for calculation.
A string describing the group for which the probability is being calculated (default: "group average").
This function checks the following cases:
If both a
and b
are NULL
, it returns an empty string.
If b
is less than or equal to a
, it throws an error.
The calculated probability and range are presented in a human-readable string
using the glue
package for formatting.