hbl_sim_pool {historicalborrowlong} | R Documentation |
Longitudinal pooled simulations.
Description
Simulate from the longitudinal pooled model.
Usage
hbl_sim_pool(
n_study = 5,
n_group = 3,
n_patient = 100,
n_rep = 4,
n_continuous = 0,
n_binary = 0,
constraint = FALSE,
s_alpha = 1,
s_delta = 1,
s_beta = 1,
s_sigma = 1,
s_lambda = 1,
covariance_current = "unstructured",
covariance_historical = "unstructured",
alpha = stats::rnorm(n = n_rep, mean = 0, sd = s_alpha),
delta = stats::rnorm(n = (n_group - 1) * (n_rep - as.integer(constraint)), mean = 0, sd
= s_delta),
beta = stats::rnorm(n = n_study * (n_continuous + n_binary), mean = 0, sd = s_delta),
sigma = stats::runif(n = n_study * n_rep, min = 0, max = s_sigma),
rho_current = stats::runif(n = 1, min = -1, max = 1),
rho_historical = stats::runif(n = n_study - 1, min = -1, max = 1)
)
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_rep |
Number of repeated measures (time points) per patient. |
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). |
constraint |
Logical of length 1, whether to pool all study arms at baseline (first rep). Appropriate when the response is the raw response (as opposed to change from baseline) and the first rep (i.e. time point) is prior to treatment. |
s_alpha |
Numeric of length 1, prior standard deviation
of the study-specific control group mean parameters |
s_delta |
Numeric of length 1, prior standard deviation
of the study-by-group effect parameters |
s_beta |
Numeric of length 1, prior standard deviation
of the fixed effects |
s_sigma |
Numeric of length 1, prior upper bound of the residual standard deviations. |
s_lambda |
shape parameter of the LKJ priors on the unstructured correlation matrices. |
covariance_current |
Character of length 1,
covariance structure of the current study.
Possible values are |
covariance_historical |
Same as |
alpha |
Numeric vector of length |
delta |
Numeric vector of length
|
beta |
Numeric vector of |
sigma |
Numeric vector of |
rho_current |
Numeric of length 1 between -1 and 1, AR(1) residual correlation parameter for the current study. |
rho_historical |
Numeric of length |
Value
A list with the following elements:
-
data
: tidy long-form dataset with the patient-level data. one row per patient per rep and indicator columns for the study, group (e.g. treatment arm), patient ID, and rep. Theresponse
columns is the patient response. The other columns are baseline covariates. The control group is the one with thegroup
column equal to 1, and the current study (non-historical) is the one with the maximum value of thestudy
column. Only the current study has any non-control-group patients, the historical studies have only the control group. -
parameters
: named list of model parameter values. See the model specification vignette for details. -
matrices
: A named list of model matrices. See the model specification vignette for details.
See Also
Other simulate:
hbl_sim_hierarchical()
,
hbl_sim_independent()
Examples
hbl_sim_pool(n_continuous = 1)$data