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

Adding r2_mlm() and possible update to r2() to work with it #764

Merged
merged 9 commits into from
Aug 28, 2024

Conversation

jluchman
Copy link
Contributor

@jluchman jluchman commented Aug 19, 2024

Fixes #758

This pull request includes a new function r2_mlm() that generates two $R^2$ values for multivariate linear regression objects/objects of class c("mlm", "lm") and is associated with issue #758.

This pull request also adds an multivariate logical argument to the r2() function for its "mlm" S3 method that can invoke the computation of the r2_mlm but is by default 'off'/FALSE and returns the current $R^2$ metric separated by response. I see value in this addition to the r2() function but do understand if it is not in the spirit of the function and it is not deemed a value add.

@DominiqueMakowski
Copy link
Member

what I consider is the opposite: running r2(mlm) would return the multivariate R2 (i.e., would run r2_mlm()), but there would be an argument (documented in r2_mlm()) to set multivariate=FALSE (true by default) that would return the r2s per response.

@jluchman
Copy link
Contributor Author

Update just pushed that incorporates the multivariate=TRUE default for r2(mlm) along with a few edits made by the linter and some minor documentation updates.

Copy link

codecov bot commented Aug 25, 2024

Codecov Report

Attention: Patch coverage is 25.53191% with 35 lines in your changes missing coverage. Please review.

Project coverage is 58.47%. Comparing base (852c1d9) to head (ee2b43f).

Files Patch % Lines
R/print-methods.R 0.00% 22 Missing ⚠️
R/r2.R 0.00% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #764      +/-   ##
==========================================
- Coverage   58.52%   58.47%   -0.05%     
==========================================
  Files          88       89       +1     
  Lines        6597     6623      +26     
==========================================
+ Hits         3861     3873      +12     
- Misses       2736     2750      +14     

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

@strengejacke
Copy link
Member

Thanks a lot, looks good to me!
Will wait for checks and then merge.

@strengejacke strengejacke merged commit d27281c into easystats:main Aug 28, 2024
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposed Multivariate $R^2$: r2_mlm for "mlm" Classed Model Objects
3 participants