R/get_coef.R

Defines functions get_coef.default

Documented in get_coef.default

#' Get a named vector of coefficients from a model object (internal function)
#' 
#' @inheritParams slopes
#' @return A named vector of coefficients. The names must match those of the variance matrix.
#' @rdname get_coef
#' @keywords internal
#' @export
get_coef <- function (model, ...) {
    UseMethod("get_coef", model)
}

#' @rdname get_coef
#' @export
get_coef.default <- function(model, ...) {
    ## faster
    # out <-  stats::coef(model)

    # more general
    out <- insight::get_parameters(model, component = "all")
    out <- stats::setNames(out$Estimate, out$Parameter)
    return(out)
}

Try the marginaleffects package in your browser

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

marginaleffects documentation built on Oct. 20, 2023, 1:07 a.m.