R/ne_noCV_noRE_stan.R

Defines functions ne_noCV_noRE_stan

Documented in ne_noCV_noRE_stan

#' Bayesian negative exponential function with Stan,
#' without cross validation, without random effects
#'
#' @export
#' @param mT Mass remaining of training data
#' @param m0 Initial mass of training data
#' @param time Vector of time values for training data
#' @param sp Numeric group identifier
#' @param J Number of groups
#' @param X Model matrix for training data
#' @param ... Arguments passed to `rstan::sampling` (e.g. iter, chains).
#' @return An object of class `stanfit` returned by `rstan::sampling`
#'
ne_noCV_noRE_stan <- function(mT, m0, time, sp, J, X, ...) {
  stan_data <- list(mT = mT,
                    m0 = m0,
                    time = time,
                    N = length(mT),
                    sp = sp,
                    J = J,
                    X = X,
                    P = ncol(X))
  out <- rstan::sampling(stanmodels$ne_noCV_noRE, data = stan_data,
                         control = list(adapt_delta = 0.99, max_treedepth = 15), ...)
  return(out)
}
smwindecker/decaymod documentation built on Sept. 28, 2021, 12:32 a.m.