Skip to content

Commit

Permalink
support ordbeta
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 22, 2023
1 parent 58dba81 commit cde432b
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 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.19.5.1
Version: 0.19.5.2
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# insight 0.19.6

## Changes to functions

* `model_info()` now recognized orderd beta families.

# insight 0.19.5

## Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion R/is_multivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' response model, or `TRUE` if a return value from a function of \pkg{insight}
#' is from a multivariate response model.
#'
#' @examples
#' @examplesIf require("rstanarm", quietly = TRUE)
#' \donttest{
#' library(rstanarm)
#' data("pbcLong")
Expand Down
1 change: 1 addition & 0 deletions R/model_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#' * `is_count`: model is a count model (i.e. family is either poisson or negative binomial)
#' * `is_beta`: family is beta
#' * `is_betabinomial`: family is beta-binomial
#' * `is_orderedbeta`: family is ordered beta
#' * `is_dirichlet`: family is dirichlet
#' * `is_exponential`: family is exponential (e.g. Gamma or Weibull)
#' * `is_logit`: model has logit link
Expand Down
15 changes: 9 additions & 6 deletions R/utils_model_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,32 @@
} else {
is_bernoulli <- TRUE
}
} else if (fitfam %in% "bernoulli") {
} else if (fitfam == "bernoulli") {
is_bernoulli <- TRUE
}


# beta family --------

beta_fam <-
inherits(x, c("betareg", "betamfx")) |
inherits(x, c("betareg", "betamfx", "ordbetareg")) |
fitfam %in% c(
"beta",
"Beta",
"betabinomial",
"Beta Inflated",
"Zero Inflated Beta",
"Beta Inflated zero",
"Beta Inflated one"
"Beta Inflated one",
"ordbeta"
)


# special families (beta-binomial, dirichlet) --------
# special families (beta-binomial, dirichlet, ordered beta) --------

betabin_fam <- inherits(x, "BBreg") | fitfam %in% "betabinomial"
dirichlet_fam <- inherits(x, "DirichletRegModel") | fitfam %in% "dirichlet"
betabin_fam <- inherits(x, "BBreg") | any(fitfam == "betabinomial")
orderedbeta_fam <- any(fitfam == "ordbeta") | inherits(x, "ordbetareg")
dirichlet_fam <- inherits(x, "DirichletRegModel") | any(fitfam == "dirichlet")

## TODO beta-binomial = binomial?
if (betabin_fam) binom_fam <- TRUE
Expand Down Expand Up @@ -393,6 +395,7 @@
is_negbin = neg_bin_fam,
is_beta = beta_fam,
is_betabinomial = betabin_fam,
is_orderedbeta = orderedbeta_fam,
is_dirichlet = dirichlet_fam,
is_exponential = exponential_fam,
is_logit = logit.link,
Expand Down
2 changes: 2 additions & 0 deletions man/is_multivariate.Rd

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

1 change: 1 addition & 0 deletions man/model_info.Rd

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

0 comments on commit cde432b

Please sign in to comment.