Skip to content

Commit

Permalink
Test get_variance for zero-inflation models
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jun 14, 2024
1 parent 94e620e commit 0ec79fe
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions R/compute_variances.R
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,28 @@
cvsquared <- tryCatch(
{
if (faminfo$link_function == "tweedie") {
# Tweedie models ------------------------------------------------------
# ---------------------------------------------------------------------
dispersion_param <- .variance_family_tweedie(x, mu, sig)

} else if (faminfo$is_zero_inflated) {
# Zero Inflated models ------------------------------------------------
# ---------------------------------------------------------------------
dispersion_param <- switch(faminfo$family,
# (zero-inflated) poisson ----
# ----------------------------
poisson = .variance_family_poisson(x, mu, faminfo),

# hurdle-poisson ----
# -------------------
`hurdle poisson` = ,
truncated_poisson = stats::family(x)$variance(sig),

# others ----
# -----------
sig
)

} else {
dispersion_param <- switch(faminfo$family,

Expand Down

0 comments on commit 0ec79fe

Please sign in to comment.