Description Usage Arguments Details Value Examples

View source: R/simulate_data.R

`gen_mixed_data`

returns randomly generated correlated bivariate mixed
outcomes, and covariate matrices to model them, based on design parameters
set in the function.

1 2 | ```
gen_mixed_data(Beta.cont, Beta.bin, N, rho, intercept = TRUE, cov = "same",
xcor = 0.25, sigma_yc = 1)
``` |

`Beta.cont` |
Vector of true regression coefficients for the continuous outcome. |

`Beta.bin` |
Vector of true regression coefficients for the binary outcome. |

`N` |
Number of pairs of correlated outcomes. |

`rho` |
Gaussian copula parameter. |

`intercept` |
Assume an intercept (for both outcomes)? (default TRUE). If TRUE, then the first coefficient in Beta.cont and Beta.bin are assumed to correspond to intercepts. |

`cov` |
Specify if the covariate matrices for the continuous outcome and the binary outcome should share all covariates (set to "same"), share some covariates (set to "shared"), or share no covariates (set to "separate"). |

`xcor` |
Correlation parameter for AR(1) correlation structure of covariate design matrices (assumed same for both). |

`sigma_yc` |
Marginal variance of continuous responses. |

A Gaussian copula is used to generate the correlated outcomes. Marginally, the continuous outcome follows a normal distribution with identity link to covariates, while the binary outcome follows a Bernoulli distribution with logit link to covariates. Covariates are generated from a zero-mean unit variance multivariate normal distribution, with an AR(1) correlation structure.

A list of generated data

`yc` |
Vector of continuous outcomes. |

`yb` |
Vector of binary outcomes. |

`X` |
Covariate matrix for the continuous outcomes. |

`Z` |
Covariate matrix for the binary outcomes. |

1 2 3 4 | ```
# default settings
gen_mixed_data(rnorm(5), rnorm(5), 10, 0.5)
# separate covariate matrices, non-unit continuous variance
gen_mixed_data(rnorm(5), rnorm(5), 10, 0.5, cov = "separate", sigma_yc = 2)
``` |

```
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.