|
1 | 1 | #' Sample covariates from multivariate normal distributions |
2 | 2 | #' |
3 | 3 | #' Samples from a multivariate normal distribution either derived from observed |
4 | | -#' data or specified directly via `means` plus a covariance matrix (`sigma`) or |
5 | | -#' standard deviations (`sd`). |
| 4 | +#' `data` or specified directly via `means` plus a covariance matrix (`sigma`) |
| 5 | +#' or standard deviations (`sd`). |
| 6 | +#' |
| 7 | +#' The `conditional` argument` can be specified only when data is used as input |
| 8 | +#' (and not with `means` and `sigma or `sd``). If `conditional`` is used in |
| 9 | +#' conjuction with `data``, it will first downsample the provided dataset to |
| 10 | +#' include only patients that match the conditional. After that, it will get |
| 11 | +#' the covariance matrix from the downsampled dataset, and draw samples from |
| 12 | +#' it. It is therefore possible that, in contrast to e.g. bootstrap sampling, |
| 13 | +#' samples are drawn that are outside of the min/max given in the conditional. |
6 | 14 | #' |
7 | 15 | #' @param data data.frame (n x p) containing the original, observed, |
8 | 16 | #' time-invariant covariates (ID should not be included) that will be used to |
@@ -71,6 +79,9 @@ sample_covariates_mvtnorm <- function( |
71 | 79 | if (!is.null(data)) { |
72 | 80 | warning("`data` is ignored when `means` is provided.") |
73 | 81 | } |
| 82 | + if(!is.null(conditional)) { |
| 83 | + warning("`conditional` is ignored when `means` is provided.") |
| 84 | + } |
74 | 85 | if (is.null(sigma) && is.null(sd)) { |
75 | 86 | stop("When `means` is supplied, either `sigma` or `sd` must also be provided.") |
76 | 87 | } |
|
0 commit comments