R/other-scam-methods.R

Defines functions `coef.scam`

#' @export
`vcov.scam` <- function (object, freq = FALSE, dispersion = NULL,
                         parametrized = TRUE, ...)  {
    if (freq) {
        vc <- if (parametrized) {
            object$Ve.t
        } else {
            object$Ve
        }
    } else {
        vc <- if (parametrized) {
            object$Vp.t
        } else {
            object$Vp
        }
    }
    if (!is.null(dispersion)) {
        vc <- dispersion * vc/object$sig2
    }
    name <- names(object$edf)
    dimnames(vc) <- list(name, name)
    vc
}

#' Extract coefficients from a fitted `scam` model.
#'
#' @param object a model object fitted by `scam()`
#' @param parametrized logical; extract parametrized coefficients, which respect the linear inequality constraints of the model.
#' @param ... other arguments.
#'
#' @export
`coef.scam` <- function(object, parametrized = TRUE, ...) {
    coefs <- if (parametrized) {
        object$coefficients.t
    } else {
        object$coefficients
    }
    coefs
}

Try the gratia package in your browser

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

gratia documentation built on Feb. 16, 2023, 10:40 p.m.