Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jul 17, 2024
1 parent 73451c1 commit 86646af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: insight
Title: Easy Access to Model Information for Various Model Objects
Version: 0.20.2.1
Version: 0.20.2.2
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
23 changes: 9 additions & 14 deletions R/get_sigma.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,51 +128,46 @@ get_sigma <- function(x, ci = NULL, verbose = TRUE) {
}


.get_sigma.lrm <- function(x, verbose = TRUE, ...) {
.get_sigma.lrm <- function(x, ...) {
s <- stats::sigma(x)
s <- s[length(s)]
class(s) <- c("insight_aux", class(s))
s
}


.get_sigma.VGAM <- function(x, verbose = TRUE, ...) {
.get_sigma.VGAM <- function(x, ...) {
s <- .safe(exp(stats::coef(x)[["(Intercept):2"]]))
class(s) <- c("insight_aux", class(s))
s
}


.get_sigma.merModList <- function(x, verbose = TRUE, ...) {
.get_sigma.merModList <- function(x, ...) {
s <- suppressWarnings(summary(x))
s <- s$residError
class(s) <- c("insight_aux", class(s))
s
}


.get_sigma.summary.lm <- function(x, verbose = TRUE, ...) {
.get_sigma.summary.lm <- function(x, ...) {
s <- x$sigma
class(s) <- c("insight_aux", class(s))
s
}


.get_sigma.selection <- function(x, verbose = TRUE, ...) {
.get_sigma.selection <- function(x, ...) {
s <- unname(stats::coef(x)["sigma"])
class(s) <- c("insight_aux", class(s))
s
}


.get_sigma.cgam <- function(x, verbose = TRUE, ...) {
s <- tryCatch(
{
sqrt(get_deviance(x, verbose = verbose) / get_df(x, type = "residual", verbose = verbose))
},
error = function(e) {
NULL
}
s <- .safe(
sqrt(get_deviance(x, verbose = verbose) / get_df(x, type = "residual", verbose = verbose))
)

if (is_empty_object(s)) {
Expand All @@ -184,7 +179,7 @@ get_sigma <- function(x, ci = NULL, verbose = TRUE) {
}


.get_sigma.cpglmm <- function(x, verbose = TRUE, ...) {
.get_sigma.cpglmm <- function(x, ...) {
s <- .safe(stats::deviance(x)[["sigmaML"]])
if (!is.null(s)) {
class(s) <- c("insight_aux", class(s))
Expand Down Expand Up @@ -212,7 +207,7 @@ get_sigma <- function(x, ci = NULL, verbose = TRUE) {
}


.get_sigma.brmsfit <- function(x, verbose = TRUE, ...) {
.get_sigma.brmsfit <- function(x, ...) {
s <- tryCatch(
{
dat <- as.data.frame(x)
Expand Down

0 comments on commit 86646af

Please sign in to comment.