Learn R Programming

basket (version 0.9.2)

mem_mcmc: Fit the MEM Model using MCMC

Description

Fit the MEM model using Bayesian Metropolis-Hasting MCMC inference.

Usage

mem_mcmc(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", mcmc_iter = 10000,
  initial_mem = round(prior - 0.001), seed = 1000, 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)

mcmc_iter

the number of MCMC iterations.

initial_mem

the initial MEM matrix.

seed

the random number seed.

call

the call of the function.

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]
)
res <- mem_mcmc(trials$responses, trials$size)
# }

Run the code above in your browser using DataLab