The number of visits is determined by the size of the variance covariance matrix.
i.e. if 3 standard deviation values are provided then 3 visits per patient will be
created.
The covariates in the simulated dataset are produced as follows:
Patients age is sampled at random from a N(0,1) distribution
Patients sex is sampled at random with a 50/50 split
Patients group is sampled at random but fixed so that each group has n/2 patients
The outcome variable is sampled from a multivariate normal distribution, see below
for details
The mean for the outcome variable is derived as:
outcome = Intercept + age + sex + visit + treatment
The coefficients for the intercept, age and sex are taken from mu$int,
mu$age and mu$sex respectively, all of which must be a length 1 numeric.
Treatment and visit coefficients are taken from mu$trt and mu$visit respectively
and must either be of length 1 (i.e. a constant affect across all visits) or equal to the
number of visits (as determined by the length of sd). I.e. if you wanted a treatment
slope of 5 and a visit slope of 1 you could specify:
mu = list(..., "trt" = c(0,5,10), "visit" = c(0,1,2))
The correlation matrix is constructed from cor as follows.
Let cor = c(a, b, c, d, e, f) then the correlation matrix would be:
1 a b d
a 1 c e
b c 1 f
d e f 1