R/sample_prior.R

Defines functions sample_prior

Documented in sample_prior

#' @description `sample_prior()` draws samples from the
#' prior distribution of the specified model object.
#'
#' @examples
#' sample_prior(mdl, seed = 42L)
#'
#' @rdname sample_posterior
#' @export
sample_prior <- function(model,
                         nsim = 2000L,
                         seed = NULL,
                         warmup = 500L,
                         nuts_control = list(),
                         ...) {
  checkmate::check_class(model, classes = c("srpmodel", "list"))
  # just call sample_posterior without data
  res <- sample_posterior(
    model = model,
    data = tibble::tibble(
        group_id = character(0L),
        subject_id = character(0L),
        t = numeric(0L),
        state = character(0L)
      ),
    now = 0,
    nsim = nsim,
    seed = seed,
    warmup = warmup,
    nuts_control = nuts_control,
    ...
  )
  return(res)
}

Try the oncomsm package in your browser

Any scripts or data that you put into this service are public.

oncomsm documentation built on April 17, 2023, 9:09 a.m.