File: methods_mlm.R

package info (click to toggle)
r-cran-marginaleffects 0.32.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,784 kB
  • sloc: sh: 13; makefile: 8
file content (29 lines) | stat: -rw-r--r-- 607 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#' @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))
}