R/get_cov.R

Defines functions get_cov

# This function gets the (vector form) of the covariance specification from an
# lm or nls object.
get_cov <- function(m, verbose){
  stopifnot(is(m, "lm") || is(m, "nls"))
  m_class <- if(is(m, "lm")) "lm" else "nls"
  w <- weights(m)
  if(is.null(w)){
    if(isTRUE(verbose)) message("Using residual standard deviation from ", m_class, " object as covariance specification...")
    covariance <- list(SqrtSigma = sigma(m))
  } else {
    if(isTRUE(verbose)) message("Using weights from ", m_class, " object as covariance specification...")
    covariance <- list(P = w)
  }
}

Try the distfreereg package in your browser

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

distfreereg documentation built on April 4, 2025, 12:30 a.m.