calc_post_beta {beastt} | R Documentation |
Calculate Posterior Beta
Description
Calculate a posterior distribution that is beta (or a mixture of beta components). Only the relevant treatment arms from the internal dataset should be read in (e.g., only the control arm if constructing a posterior distribution for the control response rate).
Usage
calc_post_beta(internal_data, response, prior)
Arguments
internal_data |
This can either be a propensity score object or a tibble of the internal data. |
response |
Name of response variable |
prior |
A distributional object corresponding to a beta distribution or a mixture distribution of beta components |
Details
For a given arm of an internal trial (e.g., the control arm or an
active treatment arm) of size , suppose the response data are binary
such that
,
. The
posterior distribution for
is written as
where is the likelihood of the
response data from the internal arm and
is a prior
distribution on
(either a beta distribution or a mixture
distribution with an arbitrary number of beta components). The posterior
distribution for
is either a beta distribution or a mixture of
beta components depending on whether the prior is a single beta
distribution or a mixture distribution.
Value
distributional object
Examples
library(dplyr)
library(distributional)
calc_post_beta(internal_data = filter(int_binary_df, trt == 1),
response = y,
prior = dist_beta(0.5, 0.5))