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

Add coefplot and groupedcoefplot for StatisticalModel #491

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

getzze
Copy link

@getzze getzze commented Feb 21, 2022

The new dependency is minimal (StatsModels), test dependencies are a bit bigger (CategoricalArrays, DataFrames, GLM).
Tested with the gr, pyplot and plotly backends.
It was tested and working with GLM.jl, MixedModels.jl and RobustModels.jl models. I don't know other packages that use the StatsModels API.

@getzze
Copy link
Author

getzze commented Apr 26, 2022

coefplot (cp1 from tests in runtests.jl)
coefplot

groupedcoefplot (slightly different cp5 from tests in runtests.jl)
groupedcoefplot

Copy link
Member

@sethaxen sethaxen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I'm happy to have this functionality in this package. It's a lot of code though, so we'll probably need a few rounds of review.

A few general comments first:

  • I know StatsPlots doesn't consistently do this (yet), but it would make the code more readable if the function calls/types were prefixed with the package name where they're defined (or implemented, if we rely on the implementation)
  • Can you make your utility function names more descriptive? This will make it easier for me to follow the code.
  • You've essentially implemented a forest plot. This is generally useful apart from plotting coefficients of statistical models. Would it make sense to refactor to a forestplot primitive and a coefplot that extracts the coefficients and passes them to forestplot?

README.md Outdated Show resolved Hide resolved
src/statsmodels.jl Outdated Show resolved Hide resolved
src/statsmodels.jl Show resolved Hide resolved
@getzze
Copy link
Author

getzze commented Sep 6, 2022

Hi, sorry for the long delay. I had some time so I refactored the code, let me know if it is clearer.
The util functions to parse the formula terms are very specific so I didn't comment them fully.

@getzze getzze requested a review from sethaxen November 29, 2022 10:37
@codecov-commenter
Copy link

codecov-commenter commented May 18, 2023

Codecov Report

Patch coverage: 71.84% and project coverage change: +11.24 🎉

Comparison is base (f14f0b0) 26.52% compared to head (115ef3c) 37.77%.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #491       +/-   ##
===========================================
+ Coverage   26.52%   37.77%   +11.24%     
===========================================
  Files          20       21        +1     
  Lines        1248     1660      +412     
===========================================
+ Hits          331      627      +296     
- Misses        917     1033      +116     
Impacted Files Coverage Δ
src/StatsPlots.jl 33.33% <ø> (ø)
src/statsmodels.jl 71.84% <71.84%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants