R/getOptim.R

Defines functions getOptim

getOptim <- function(object) {
  if (!is.DstarM(object)) {
    stop("Input must be of class DstarM.", call. = FALSE)
  } else {
    name <- names(object)[1]
    if (name == "Bestvals") {
      return(object$GlobalOptimizer$optim$bestval)
    } else if (name == "r.hat") {
      return(sapply(object$GlobalOptimizer, function(x) x$optim$bestval))
    } else {
      warning("No optimizer information available for this object.")
      return(NULL)
    }
  }
}

Try the DstarM package in your browser

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

DstarM documentation built on Aug. 29, 2020, 1:06 a.m.