mvrnorm_corr_gen {microbiomeDASim} | R Documentation

## Generate Multivariate Random Normal Longitudinal Data

### Description

For this methodology we assume that we draw a set of `n` independent each with q_{i} observations.

### Usage

    mvrnorm_corr_gen(n, obs, mu, sigma, rho, corr_str = c("ar1", "compound",
      "ind"), zero_trunc = TRUE)

### Arguments

`n` | integer scalar representing the total number of individuals
`obs` | integer or vector specifying the number of observations per indivdiual. If an integer then all indivdiuals are assummed to have the same number of obsevations. If a vector, then the vector must have length equal to `n` where each element specifies the number of observations for the i^{th} individual.
`mu` | integer or vector specifying the mean value for individuals. If an integer then all indivdiuals are assummed to have the same mean. If a vector, then the vector must have length equal to `n` where each element specifies the mean for the i^{th} individual.
`sigma` | numeric scalar or vector specifying the standard deviation for observations.
`rho` | numeric scalar value between [0, 1] specifying the amount of correlation between. assumes that the correlation is consistent for all subjects.
`corr_str` | character value specifying the correlation structure. Currently available methods are 'ar1', 'compound', and 'ind' which correspond to first-order autoregressive, compound or equicorrelation, and independence respecitvely.
`zero_trunc` | logical value to specifying whether the generating distribution should come from a multivariate zero truncated normal or an untruncated multivariate normal. by default we assume that zero truncation occurs since this is assummed in our microbiome setting.

### Value

This function returns a list with the following objects:

`df` - data.frame object with complete outcome `Y`, subject ID, time, group, and outcome with missing data

`Y` - vector of complete outcome

`Mu` - vector of complete mean specifications used during simulation

`Sigma` - block diagonal symmetric matrix of complete data used during simulation

`N` - total number of observations

### Examples

    mvrnorm_corr_gen(n=15, obs=4, mu=20, sigma=2, rho=0.9, corr_str="ar1")

[Package microbiomeDASim version 1.0.0 Index]