R/simulate.R

Defines functions simulate.bbdml

Documented in simulate.bbdml

#' Simulate from beta-binomial model
#'
#' @param object an object of class \code{bbdml}
#' @param nsim Integer. Number of simulations
#' @param seed Optional integer to set a random seed
#' @param ... There are no additional parameters at this time.
#'
#' @return \code{nsim} simulations from \code{object}
#'
#' @importFrom stats simulate
#' @export
simulate.bbdml <- function(object, nsim, seed = NULL, ...) {
  if (!is.null(seed)) {set.seed(seed)}
  return(VGAM::rbetabinom(n = nsim, size = object$M, prob = object$mu.resp, rho = object$phi.resp))
}

Try the corncob package in your browser

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

corncob documentation built on Aug. 31, 2023, 9:06 a.m.