Skip to content

Add coefplot and groupedcoefplot for StatisticalModel#491

Open
getzze wants to merge 10 commits intoJuliaPlots:masterfrom
getzze:coefplot
Open

Add coefplot and groupedcoefplot for StatisticalModel#491
getzze wants to merge 10 commits intoJuliaPlots:masterfrom
getzze:coefplot

Conversation

@getzze
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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?

Comment thread README.md Outdated
Comment thread src/statsmodels.jl Outdated
Comment thread src/statsmodels.jl
@getzze
Copy link
Copy Markdown
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
Copy Markdown

codecov-commenter commented May 18, 2023

Codecov Report

❌ Patch coverage is 71.84466% with 116 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.77%. Comparing base (f14f0b0) to head (115ef3c).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
src/statsmodels.jl 71.84% 116 Missing ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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