diff --git a/DESCRIPTION b/DESCRIPTION index 986d366..dc8b36a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: irxforge Title: Forging data for pharmacometric analyses -Version: 0.0.0.9002 +Version: 0.0.0.9003 Authors@R: c( person("Ron", "Keizer", email = "ron@insight-rx.com", role = c("cre", "aut")), person("Michael", "McCarthy", email = "michael.mccarthy@insight-rx.com", role = "ctb"), diff --git a/R/sample_covariates_mvtnorm.R b/R/sample_covariates_mvtnorm.R index 67aa689..de00e23 100644 --- a/R/sample_covariates_mvtnorm.R +++ b/R/sample_covariates_mvtnorm.R @@ -1,8 +1,16 @@ #' Sample covariates from multivariate normal distributions #' #' Samples from a multivariate normal distribution either derived from observed -#' data or specified directly via `means` plus a covariance matrix (`sigma`) or -#' standard deviations (`sd`). +#' `data` or specified directly via `means` plus a covariance matrix (`sigma`) +#' or standard deviations (`sd`). +#' +#' The `conditional` argument` can be specified only when data is used as input +#' (and not with `means` and `sigma or `sd``). If `conditional`` is used in +#' conjuction with `data``, it will first downsample the provided dataset to +#' include only patients that match the conditional. After that, it will get +#' the covariance matrix from the downsampled dataset, and draw samples from +#' it. It is therefore possible that, in contrast to e.g. bootstrap sampling, +#' samples are drawn that are outside of the min/max given in the conditional. #' #' @param data data.frame (n x p) containing the original, observed, #' time-invariant covariates (ID should not be included) that will be used to @@ -71,6 +79,9 @@ sample_covariates_mvtnorm <- function( if (!is.null(data)) { warning("`data` is ignored when `means` is provided.") } + if(!is.null(conditional)) { + warning("`conditional` is ignored when `means` is provided.") + } if (is.null(sigma) && is.null(sd)) { stop("When `means` is supplied, either `sigma` or `sd` must also be provided.") } diff --git a/man/sample_covariates_mvtnorm.Rd b/man/sample_covariates_mvtnorm.Rd index 201b817..54b8d0a 100644 --- a/man/sample_covariates_mvtnorm.Rd +++ b/man/sample_covariates_mvtnorm.Rd @@ -61,8 +61,15 @@ rows and \code{p} columns } \description{ Samples from a multivariate normal distribution either derived from observed -data or specified directly via \code{means} plus a covariance matrix (\code{sigma}) or -standard deviations (\code{sd}). +\code{data} or specified directly via \code{means} plus a covariance matrix (\code{sigma}) +or standard deviations (\code{sd}). +} +\details{ +The \code{conditional} argument\verb{can be specified only when data is used as input (and not with}means\code{and}sigma or \verb{sd``). If }conditional\verb{ is used in conjuction with `data}, it will first downsample the provided dataset to +include only patients that match the conditional. After that, it will get +the covariance matrix from the downsampled dataset, and draw samples from +it. It is therefore possible that, in contrast to e.g. bootstrap sampling, +samples are drawn that are outside of the min/max given in the conditional. } \note{ missing values in \code{data} must be coded as NA