bma {bmabasket} | R Documentation |
Compute posterior model probabilities
Description
Given data and hyperparameters, computes posterior model probabilities
Usage
bma(pi0, y, n, P = NULL, mu0 = 0.5, phi0 = 1, priorModelProbs = NULL, pmp0 = 1)
Arguments
pi0 |
scalar or vector whose elements are between 0 and 1 giving threshold for the hypothesis test. If a scalar is provided, assumes same threshold for each basket |
y |
vector of responses |
n |
vector of sample sizes |
P |
integer giving maximum number of distinct parameters; default is all possible models |
mu0 |
prior mean for beta prior |
phi0 |
prior dispersion for beta prior |
priorModelProbs |
(optional) vector giving prior for models. Default is proportional to |
pmp0 |
nonnegative scalar. Value of 0 corresponds to uniform prior across model space. Ignored if priorModelProbs is specified |
Value
a list with the following structure:
- bmaProbs
model-averaged probabilities that each basket is larger than
pi0
- bmaMeans
model-averaged posterior mean for each basket
Examples
## Simulate data with 3 baskets
probs <- c(0.5, 0.25, 0.25)
n <- rep(100, length(probs))
y <- rbinom(length(probs), size = n, prob = probs)
bma(0.5, y, n)