Description Usage Arguments Author(s) See Also Examples
View source: R/createTimeVaryingCovariates.R
Creates a set of time-varying covariates from a multivariate normal distribution and (optionally) a set of constraints.
1 2 3 4 5 6 7 8 9 10 11 | createTimeVaryingCovariates(subjects,
names,
mean,
covariance = 0,
range = NULL,
digits,
maxDraws = 100,
seed = .deriveFromMasterSeed(),
idCol = getEctdColName("Subject"),
timeCol = getEctdColName("Time"),
treatPeriod)
|
subjects |
(Required) Subjects for which to create covariates |
names |
(Required) Names for the continuous covariates. They should be valid R names
(See |
mean |
(Required) List of means. Must be of same length than |
covariance |
(Optional) Lower triangle of covariance matrix. See
|
range |
(Optional) Ranges of acceptable values for each covariates. See
|
digits |
(Optional) Number of digits used to round the values. This argument can be
either missing (the default), so no rounding is done, of length one and all variables are
rounded at the same digits, of same length than the number of covariates so that each
covariate is rounded according to its value. This argument is first parsed by
|
maxDraws |
(Optional) Maximum number of attempts allowed if initial data not in range (100 by default) |
seed |
(Optional) Random seed to use. By default, this is derived from the current random seed |
idCol |
(Optional) Name of the subject column. Must be a valid R name (See
|
timeCol |
(Optional) Name of the time column. Must be a valid R name (See
|
treatPeriod |
Vector of time points |
Mike K Smith mstoolkit@googlemail.com
createDiscreteCovariates
to create covariates for a discrete distribution.
createExternalCovariates
to create covariates by sampling
data from an external file.
createCovariates
that wraps createContinuousCovariates
and the
two other described above.
1 2 3 4 5 6 | # same
dat <- createTimeVaryingCovariates(10, "X, Y, Z",
mean <- list(X = 1:4, Y = rep(3, 4), Z = "2.5, 3, 3.2, 3.6"),
covariance = list(1, 2:5, cbind(c(1,.5,.3,0), c(.5,1,0,0), c(.3,0,1,0), c(0,0,0,1))),
range = list("10>=X>0", NULL, c("Z>0", "Z<=10")),
idCol = "SUBJ", timeCol = "TIME", treatPeriod = c(0.25, 0.5, 1, 12))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.