R/check_params.R

Defines functions check_theta check_alpha

Documented in check_alpha check_theta

#' Check validity of copula parameters
#'
#' Ensures input values are non-negative.
#'
#' @param theta Values of theta to check.
#' @param alpha Values of alpha to check.
#' @return An error if any theta or alpha is negative;
#' an invisible value otherwise. `NA` values do not throw an error.
#' @rdname check_params
check_alpha <- function(alpha) {
  if (isTRUE(any(alpha < 0))) {
    stop("`alpha` parameter must be positive.")
  }
}


#' @rdname check_params
check_theta <- function(theta) {
  if (isTRUE(any(theta < 0))) {
    stop("`theta` parameter must be positive.")
  }
}

Try the igcop package in your browser

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

igcop documentation built on Nov. 14, 2023, 5:10 p.m.