hb_sim_mixture {historicalborrow}R Documentation

Non-longitudinal mixture simulations.

Description

Simulate from the non-longitudinal mixture model.

Usage

hb_sim_mixture(
  n_study = 5,
  n_group = 3,
  n_patient = 100,
  n_continuous = 0,
  n_binary = 0,
  s_delta = 1,
  s_beta = 1,
  s_sigma = 1,
  m_omega = 0,
  s_omega = 1,
  p_omega = 1/n_study,
  alpha = omega[pi],
  delta = stats::rnorm(n = n_group - 1, mean = 0, sd = s_delta),
  beta = stats::rnorm(n = n_continuous + n_binary, mean = 0, sd = s_delta),
  sigma = stats::runif(n = 1, min = 0, max = s_sigma),
  pi = sample.int(n = n_study, size = 1, prob = p_omega),
  omega = stats::rnorm(n = n_study, mean = m_omega, sd = s_omega)
)

Arguments

n_study

Number of studies to simulate.

n_group

Number of groups (e.g. study arms) to simulate per study.

n_patient

Number of patients to simulate per study per group.

n_continuous

Number of continuous covariates to simulate (all from independent standard normal distributions).

n_binary

Number of binary covariates to simulate (all from independent Bernoulli distributions with p = 0.5).

s_delta

Numeric of length 1, prior standard deviation of the study-by-group effect parameters delta.

s_beta

Numeric of length 1, prior standard deviation of the fixed effects beta.

s_sigma

Numeric of length 1, prior upper bound of the residual standard deviations.

m_omega

Numeric of length 1 or n_study, prior control group mean of each study. If length n_study, then the last element corresponds to the current study, and the others are for historical studies.

s_omega

Numeric of length 1 or n_study, prior control group standard deviation of each study. If length n_study, the the last element corresponds to the current study, and the others are for historical studies.

p_omega

Numeric of length n_study, prior mixture proportion of each study. If length n_study, then the last element corresponds to the current study, and the others are for historical studies.

alpha

Numeric vector of length 1 for the pooled and mixture models and length n_study for the independent and hierarchical models. alpha is the vector of control group mean parameters. alpha enters the model by multiplying with ⁠$matrices$x_alpha⁠ (see the return value). The control group in the data is the one with the group column equal to 1.

delta

Numeric vector of length n_group - 1 of treatment effect parameters. delta enters the model by multiplying with ⁠$matrices$x_delta⁠ (see the return value). The control (non-treatment) group in the data is the one with the group column equal to 1.

beta

Numeric vector of n_continuous + n_binary fixed effect parameters. The first n_continuous betas are for the continuous covariates, and the rest are for the binary covariates. betas enters the model by multiplying with ⁠$matrices$x_alpha⁠ (see the return value).

sigma

Numeric vector of n_study study-specific residual standard deviations.

pi

Integer of length 1, index of the mixture component randomly chosen for alpha.

omega

Numeric of length n_study, Candidate placebo mean parameters drawn from each of the mixture components.

Value

A list with the following elements:

See Also

Other simulate: hb_sim_hierarchical(), hb_sim_independent(), hb_sim_pool()

Examples

hb_sim_mixture()$data

[Package historicalborrow version 1.0.4 Index]