Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Nov 19, 2024
1 parent 2dd09fd commit ad962ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
11 changes: 7 additions & 4 deletions R/methods_glmmTMB.R
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,6 @@ ci.glmmTMB <- function(x,

# standard_error -----


#' @rdname standard_error
#' @export
standard_error.glmmTMB <- function(model,
effects = "fixed",
Expand All @@ -481,7 +479,10 @@ standard_error.glmmTMB <- function(model,
component,
c("all", "conditional", "zi", "zero_inflated", "dispersion")
)
effects <- insight::validate_argument(effects, c("fixed", "random"))
effects <- insight::validate_argument(
effects,
c("fixed", "random")
)

dot_args <- .check_dots(
dots = list(...),
Expand All @@ -492,12 +493,14 @@ standard_error.glmmTMB <- function(model,
)

if (effects == "random") {
if (!requireNamespace("TMB", quietly = TRUE) && !requireNamespace("glmmTMB", quietly = TRUE)) {
if (!all(insight::check_if_installed(c("TMB", "glmmTMB"), quietly = TRUE))) {
return(NULL)
}

s1 <- TMB::sdreport(model$obj, getJointPrecision = TRUE)
s2 <- sqrt(s1$diag.cov.random)
rand.ef <- glmmTMB::ranef(model)[[1]]

rand.se <- lapply(rand.ef, function(.x) {
cnt <- nrow(.x) * ncol(.x)
s3 <- s2[1:cnt]
Expand Down
12 changes: 1 addition & 11 deletions man/standard_error.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ad962ed

Please sign in to comment.