Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jun 24, 2022
1 parent 194bcb7 commit fac4d09
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

## Bug fixes

* `get_sigma()` for models from package _VGAM_ returned wrong sigma-parameter.

* `find_predictors()` for models from package _fixest_ that contained
interaction terms in the endogenous formula part did not correctly return
all instruments.
Expand Down
29 changes: 24 additions & 5 deletions R/get_sigma.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,31 +88,50 @@ get_sigma <- function(x, ci = NULL, verbose = TRUE) {

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

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

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

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

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

.get_sigma.cpglmm <- function(x, verbose = TRUE, ...) {
tryCatch(
s <- tryCatch(
{
stats::deviance(x)[["sigmaML"]]
},
error = function(e) {
NULL
}
)
if (!is.null(s)) {
class(s) <- c("insight_aux", class(s))
}
s
}

.get_sigma.brmsfit <- function(x, verbose = TRUE, ...) {
Expand Down

0 comments on commit fac4d09

Please sign in to comment.