calcProb {imt}R Documentation

Calculate Probability of Posterior Draws Falling Within a Range

Description

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.

Usage

calcProb(x, a = NULL, b = NULL, prior = FALSE, group_name = "group average")

Arguments

x

A numeric vector containing either posterior draws (default) or prior samples of the treatment effect parameter (eta).

a

(Optional) The lower bound of the range (as a proportion, not percentage).

b

(Optional) The upper bound of the range (as a proportion, not percentage).

prior

A logical value indicating whether to use prior samples (TRUE) or posterior draws (FALSE, default) for calculation.

group_name

A string describing the group for which the probability is being calculated (default: "group average").

Details

This function checks the following cases:

The calculated probability and range are presented in a human-readable string using the glue package for formatting.

Value

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.


[Package imt version 1.0.0 Index]