bma | R Documentation |
Given data and hyperparameters, computes posterior model probabilities
bma(pi0, y, n, P = NULL, mu0 = 0.5, phi0 = 1, priorModelProbs = NULL, pmp0 = 1)
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 |
a list with the following structure:
model-averaged probabilities that each basket is larger than pi0
model-averaged posterior mean for each basket
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.