Learn R Programming

basket (version 0.9.2)

mem_exact: Fit the Exact MEM Model

Description

Fit the MEM model using full Bayesian inference.

Usage

mem_exact(responses, size, name, p0 = 0.15, shape1 = 0.5,
  shape2 = 0.5, prior = diag(length(responses))/2 + matrix(0.5, nrow =
  length(responses), ncol = length(responses)), hpd_alpha = 0.05,
  alternative = "greater", call = NULL)

Arguments

responses

the number of responses in each basket.

size

the size of each basket.

name

the name of each basket.

p0

the null response rate for the poster probability calculation (default 0.15).

shape1

the first shape parameter(s) for the prior of each basket (default 0.5).

shape2

the second shape parameter(s) for the prior of each basket (default 0.5).

prior

the matrix giving the prior inclusion probability for each pair of baskets. The default is on on the main diagonal and 0.5 elsewhere.

hpd_alpha

the highest posterior density trial significance.

alternative

the alternative case definition (default greater)

call

the call of the function (default NULL).

Examples

Run this code
# NOT RUN {
# 3 baskets, each with enrollement size 5
trial_sizes <- rep(5, 3)

# The response rates for the baskets.
resp_rate <- 0.15

# The trials: a column of the number of responses and a column of the
# the size of each trial.
trials <- data.frame(
  responses = rbinom(trial_sizes, trial_sizes, resp_rate),
  size = trial_sizes,
  name = letters[1:3]
)

summary(mem_exact(trials$responses, trials$size, trials$name))
# }

Run the code above in your browser using DataLab