R/simexit.R

Defines functions simexit

simexit <- function(entry, all.bhr, eta.ij, x.i, max.time, pme){
  result <- NULL
  while(is.null(result)){
    u <- runif(1)
    try(result <- simexitinner(u = u, entry = entry, all.bhr = all.bhr, 
                               eta.ij = eta.ij, x.i = x.i, max.time = max.time, pme = pme), 
        silent = TRUE)
    if(is.null(result)){
      stop(paste("It was not possible to simulate a new exit time!\n", 
                 " + Check if eta functions are vectorised, and/or\n", 
                 " + increase (only those larger 0) the baseline hazard rates ", 
                 paste(names(all.bhr), collapse = ", "), ", and/or (if used)\n", 
                 " + decrease partial-markov effects!", sep = ""))
    }
  }
  return(result)
}

Try the simMSM package in your browser

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

simMSM documentation built on May 6, 2022, 9:05 a.m.