Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should check_overdispersion give warning when applied to quasipoisson? #734

Open
jmgirard opened this issue Jun 13, 2024 · 1 comment
Open
Labels
3 investigators ❔❓ Need to look further into this issue

Comments

@jmgirard
Copy link
Contributor

check_overdispersion() seems to just be returning the same results for poisson and quasipoisson. I think the latter should be based on simulated residuals, but that's not enabled yet so maybe that's why?

library(easystats)
#> # Attaching packages: easystats 0.7.2
#> ✔ bayestestR  0.13.2.2   ✔ correlation 0.8.4   
#> ✔ datawizard  0.11.0.2   ✔ effectsize  0.8.8.1 
#> ✔ insight     0.20.1     ✔ modelbased  0.8.8   
#> ✔ performance 0.12.0     ✔ parameters  0.21.7.4
#> ✔ report      0.5.8      ✔ see         0.8.4

Poisson - correct

fit <- glm(
  formula = DriversKilled ~ PetrolPrice,
  family = poisson(link = "log"),
  data = Seatbelts
)
check_overdispersion(fit)
#> # Overdispersion test
#> 
#>        dispersion ratio =   4.470
#>   Pearson's Chi-Squared = 849.362
#>                 p-value = < 0.001
#> Overdispersion detected.
simulate_residuals(fit)
#> Simulated residuals from a model of class `glm` based on 250
#>   simulations. Use `check_residuals()` to check uniformity of residuals or
#>   `residuals()` to extract simulated residuals. It is recommended to refer
#>   to `?DHARMa::simulateResiudals` and `vignette("DHARMa")` for more
#>   information about different settings in particular situations or for
#>   particular models.

Quasi-poisson - incorrect?

fit2 <- glm(
  formula = DriversKilled ~ PetrolPrice,
  family = quasipoisson(link = "log"),
  data = Seatbelts
)
check_overdispersion(fit2)
#> # Overdispersion test
#> 
#>        dispersion ratio =   4.470
#>   Pearson's Chi-Squared = 849.362
#>                 p-value = < 0.001
#> Overdispersion detected.
simulate_residuals(fit2)
#> Error in simulate.lm(object, nsim = nsim, ...): family 'quasipoisson' not implemented

Created on 2024-06-13 with reprex v2.1.0

@strengejacke strengejacke added the 3 investigators ❔❓ Need to look further into this issue label Jun 18, 2024
@strengejacke
Copy link
Member

@bwiernik Not sure whether the same check can be applied to quasi-poisson or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 investigators ❔❓ Need to look further into this issue
Projects
None yet
Development

No branches or pull requests

2 participants