R/methods_mlm.R

Defines functions get_group_names.mlm get_coef.mlm set_coef.mlm

Documented in get_coef.mlm get_group_names.mlm set_coef.mlm

#' @include set_coef.R
#' @rdname set_coef
#' @export
set_coef.mlm <- function(model, coefs, ...) {
    model$coefficients[] <- coefs

    return(model)
}

#' @include get_coef.R
#' @rdname get_coef
#' @export
get_coef.mlm <- function(model, ...) {
    out <- insight::get_parameters(model, ...)
    out <- stats::setNames(
        out$Estimate,
        sprintf("%s:%s", out$Response, out$Parameter)
    )
    return(out)
}


#' @include get_group_names.R
#' @rdname get_group_names
#' @export
get_group_names.mlm <- function(model, ...) {
    resp <- insight::get_response(model)
    return(names(resp))
}

Try the marginaleffects package in your browser

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

marginaleffects documentation built on June 8, 2025, 12:44 p.m.