mem_exact: Fit the Exact MEM Model

View source: R/mem-exact.r

mem_exactR Documentation

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",
  seed = 1000,
  cluster_analysis = FALSE,
  call = NULL,
  cluster_function = cluster_membership
)

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)

seed

the random number seed.

cluster_analysis

if the cluster analysis is conducted.

call

the call of the function (default NULL).

cluster_function

a function to cluster baskets

See Also

cluster_membership

Examples


# 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))


presagia-analytics/basket documentation built on July 26, 2023, 2:10 p.m.