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

Don't test assumptions that are not required #260

Closed
mattansb opened this issue Apr 8, 2021 · 6 comments
Closed

Don't test assumptions that are not required #260

mattansb opened this issue Apr 8, 2021 · 6 comments
Labels
Consistency 🍏 🍎 Expected output across functions could be more similar Enhancement 💥 Implemented features can be improved or revised

Comments

@mattansb
Copy link
Member

mattansb commented Apr 8, 2021

By model type.

Here are some examples that should not work. (@bwiernik Can you double check me?)

m <- glm(am ~ mpg, mtcars,
         family = binomial())

performance::check_normality(m)
#> OK: residuals appear as normally distributed (p = 0.059).


m <- glm(gear ~ mpg, mtcars,
         family = poisson())

performance::check_normality(m)
#> Warning: Non-normality of residuals detected (p = 0.001).

performance::check_heteroscedasticity(m) # fails properly
#> Error in check_heteroscedasticity.default(m): This Breusch-Pagan Test currently only works Gaussian models.

Created on 2021-04-08 by the reprex package (v1.0.0)

@IndrajeetPatil IndrajeetPatil added Consistency 🍏 🍎 Expected output across functions could be more similar Enhancement 💥 Implemented features can be improved or revised labels Apr 8, 2021
@bwiernik
Copy link
Contributor

bwiernik commented Apr 8, 2021

Yeah, this is a good point.

performance::check_normality should return a message indicating that no normality assumption is needed when family isn't normal.

For heteroscedasticity, we could direct the user toward more appropriate checks, such as overdispersion.

It would be good to make a list of families each check is relevant for.

I don't know that family-mismatch problems like this necessarily warrant errors--messages are probably more appropriate. Similarly, are warnings really needed when the assumption is violated? That might produce weirdness if someone has set warnings = error. Perhaps messages would again be better?

@strengejacke
Copy link
Member

when family isn't normal.

Does this include/exclude inverse-Gaussian and similar? And what about istrumental/2SLS, or truncated/censored?

@bwiernik
Copy link
Contributor

bwiernik commented Apr 8, 2021

Need to think through the various models/families that we support. Not sure off hand about inverse-Gaussian. IV/2SLS doesn't have a normality assumption I don't think. Tobit models have a normality assumption on the latent variable, so a different test is needed.

strengejacke added a commit that referenced this issue Apr 9, 2021
@strengejacke
Copy link
Member

We could have a vignette that simply lists the available check-functions depending on model type, like:

  • tests for linear regresion: check_..., ...
  • tests for logistic regresion: binned_residuals(), ...

Anyone willing to do this? 😄

@IndrajeetPatil
Copy link
Member

I think this is a good idea. I will make an entry for this here and will work on it as I find time.

@strengejacke
Copy link
Member

Closing in favour of #376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Consistency 🍏 🍎 Expected output across functions could be more similar Enhancement 💥 Implemented features can be improved or revised
Projects
None yet
Development

No branches or pull requests

4 participants