diff --git a/vignettes/correlated.Rmd b/vignettes/correlated.Rmd index 00ec5001..9b0c1510 100644 --- a/vignettes/correlated.Rmd +++ b/vignettes/correlated.Rmd @@ -40,7 +40,7 @@ ggtheme <- function(panelback = "white") { ## Correlated data -Sometimes it is desirable to simulate correlated data from a correlation matrix directly. For example, a simulation might require two random effects (e.g. a random intercept and a random slope). Correlated data like this could be generated using the `defData` functionality, but it may be more natural to do this with `genCorData` or `addCorData`. Currently, simstudy can only generate multivariate normal using these functions. (In the future, additional distributions will be available.) +Sometimes it is desirable to simulate correlated data from a correlation matrix directly. For example, a simulation might require two random effects (e.g. a random intercept and a random slope). Correlated data like this could be generated using the `defData` functionality, but it may be more natural to do this with `genCorData` or `addCorData`. Currently, simstudy can only generate multivariate normal using these functions. `genCorData` requires the user to specify a mean vector `mu`, a single standard deviation or a vector of standard deviations `sigma`, and either a correlation matrix `corMatrix` or a correlation coefficient `rho` and a correlation structure `corsrt`. Here are a few examples: @@ -103,7 +103,7 @@ dt[,round(sqrt(diag(var(cbind(a0, a1)))),1)] Two additional functions facilitate the generation of correlated data from *binomial*, *poisson*, *gamma*, and *uniform* distributions: `genCorGen` and `addCorGen`. -`genCorGen` is an extension of `genCorData`. In the first example, we are generating data from a multivariate Poisson distribution. We start by specifying the mean of the Poisson distribution for each new variable, and then we specify the correlation structure, just as we did with the normal distribution. +`genCorGen` is an extension of `genCorData`. These functions draw on copula-based methods to generate the data. (This [Wikipedia page](https://bit.ly/31vAxFf) provides a general introduction and copula-based modeling can be conducted in `R` using package [copula](https://cran.r-project.org/web/packages/copula/index.html).) In the first example, we are generating data from a multivariate Poisson distribution. We start by specifying the mean of the Poisson distribution for each new variable, and then we specify the correlation structure, just as we did with the normal distribution. ```{r} l <- c(8, 10, 12) # lambda for each new variable