R/get_initial_extra.R

Defines functions get_initial_extra

#' Get initial values for the extra parameter (in four parameter geostatistical models)
#'
#' @param spcov_type The spatial covariance type
#'
#' @return An extra initial value
#'
#' @noRd
get_initial_extra <- function(spcov_type) {
  # only covariance types with a fourth ("extra"/smoothness) parameter get a
  # starting value here; these defaults are reasonable general-purpose choices
  # for the Matern smoothness, Cauchy shape, and powered-exponential exponent
  if (spcov_type == "matern") {
    initial_extra <- 2
  } else if (spcov_type == "cauchy") {
    initial_extra <- 1
  } else if (spcov_type == "pexponential") {
    initial_extra <- 0.8
  } else {
    initial_extra <- NULL # so it can be run with 3 parameter models without a logical statement
  }
  initial_extra
}

Try the spmodel package in your browser

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

spmodel documentation built on Sept. 11, 2026, 1:07 a.m.