R/GLMMadaptive_tidiers.R

Defines functions tidy.MixMod

## INCOMPLETE

#' @export
tidy.MixMod <- function(x, effects = c("fixed","ran_pars"), conf.int=TRUE,
                        conf.level=0.95, ...) {
    estimate <- std.error <- NULL ## R CMD check/NSE
    effects <- match.arg(effects)
    ret <- (coef(summary(x))
        %>% as.data.frame()
        %>% tibble::rownames_to_column("term")
        %>% rename(estimate="Estimate",
                   std.error="Std.Err",
                   statistic="z-value",
                   p.value="p-value")
    )
    if (conf.int) {
        qq <- qnorm((1+c(-1,1)*conf.level)/2)
        ret <- (ret
            %>% mutate(conf.low=estimate+qq[1]*std.error,
                       conf.high=estimate+qq[2]*std.error)
        )
    }
    return(ret)
}

Try the broom.mixed package in your browser

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

broom.mixed documentation built on April 18, 2022, 1:06 a.m.