Description Usage Arguments Value Examples
Generate a data set using a study_parameters
-object
1 2 3 4 5 6 7 | simulate_data(paras, n = 1)
## S3 method for class 'plcp'
simulate_data(paras, n = NULL)
## S3 method for class 'plcp_multi'
simulate_data(paras, n = 1)
|
paras |
An object created by |
n |
Optional; specifies which row |
A data.frame
with the simulated data in long form. With the following columns:
y
the outcome vector, with missing values as NA
y_c
the outcome vector, without missing values removed.
time
the time vector
treatment
treatment indicator (0 = "control", 1 = "treatment")
subject
subject-level id variable, from 1 to total number of subjects.
cluster
for three-level models; the cluster-level id variable,
from 1 to the total number of clusters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | p <- study_parameters(n1 = 11,
n2 = 10,
n3 = 4,
T_end = 10,
fixed_intercept = 37,
fixed_slope = -0.65,
sigma_subject_intercept = 2.89,
sigma_cluster_intercept = 0.6,
icc_slope = 0.1,
var_ratio = 0.03,
sigma_error = 1.5,
cor_subject = -0.5,
cor_cluster = 0,
cohend = 0.5)
d <- simulate_data(p)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.