simulate_study: Simulate a study

View source: R/simulate.R

simulate_studyR Documentation

Simulate a study

Description

Simulate a study

Usage

simulate_study(study, theta, a, b, n_draws = 3000)

Arguments

study

A study whose phases will be simulated in sequence.

theta

A vector of true event probabilities in each arm.

a, b

Vectors of parameters to the beta prior with elements for each arm. Recycled to match the length of theta if possible.

n_draws

The number of draws to sample from the posterior for evaluating posterior probabilities in allocation rules.

See Also

study for options for study types. phase() for defining study phases. allocation_rule for available rules for treatment allocation.

Examples

# A single-phase study uses the same allocation rule throughout
simulate_study(
  single_phase_study(n = 240, rule = rule_1(epsilon = 0.1)),
  a = 1,
  b = 1,
  theta = 0.2 + 1:4 / 10
)

# A multi-phase study can e.g. have a burn-in period with another rule
simulate_study(
  multi_phase_study(phases = list(
    phase(n = 40, rule = randomization_list()),
    phase(n = 200, rule = rule_1(epsilon = 0.1))
  )),
  a = 1,
  b = 1,
  theta = 0.2 + 1:4 / 10
)

Orion-Corporation/barts documentation built on July 13, 2022, 10:23 p.m.