[jaspRegression] AIC and BIC weights in linear regression#475
[jaspRegression] AIC and BIC weights in linear regression#475sisyphus-jasp wants to merge 2 commits into
Conversation
|
This looks good on the first look, didn't run the code. If it is correct, maybe we should add a second issue for adding this to logistic regression as well if appropriate? |
|
There are two unit tests that are now failing that seemed fine before - can this be fixed by @sisyphus-jasp? |
|
Als note that the option name does not follow the JASP style guide: https://github.com/jasp-stats/jasp-desktop/blob/development/Docs/development/guide-option-names.md#abbreviations-are-single-words |
|
great that your leaving feedback directly in the PR, I will be scraping those to improve the internal review process before a PR gets created :) currently, the bot can only one-shot PR, hopefully next week it will be able to start responding to reviews in the thread and submitting updates |
|
the unit test fails seems to be because of polr dependency set up, that's a bit out of control for us tbh |
FBartos
left a comment
There was a problem hiding this comment.
please fix comments above (ignore the two failing tests, its from upstream)
|
the naming now seems correct, you, can leave more feedback if needed @JohnnyDoorn and @Kucharssim -- I will get the update re-triggered manually now (later this will be automatic) And someone should actually test the code running it in JASP :) |
Summary
Fixes: https://github.com/jasp-stats/INTERNAL-jasp/issues/2896
Fix Summary: AIC and BIC weights in linear regression
What was wrong (root cause)
The linear regression analysis in JASP displayed AIC and BIC values when the "AIC and BIC" option was enabled, but did not display AIC and BIC weights. AIC/BIC weights are commonly used for model comparison in statistical software - they are normalized probabilities that sum to 1 across all models.
What was changed and why
Changes made:
QML (inst/qml/RegressionLinear.qml):
modelAICBICWeightswith label "AIC and BIC weights"R (R/regressionlinear.R):
$dependOn()to include the newmodelAICBICWeightsoption.linregFillSummaryTable()function to:optionsas a parameterweight_i = exp(-0.5 * delta_i) / sum(exp(-0.5 * delta_j))Implementation details:
w_i = exp(-0.5 * delta_i) / sum(exp(-0.5 * delta_j))delta_i = IC_i - min(IC)(difference from the best model)modelAICBICANDmodelAICBICWeightsare TRUETest results
Files modified
inst/qml/RegressionLinear.qml- Added new checkbox for AIC/BIC weightsR/regressionlinear.R- Added weight calculation and display logicImplementation Plan
Plan: Fix AIC and BIC weights in linear regression
Root Cause
The linear regression analysis shows AIC and BIC values when the "AIC and BIC" option is enabled, but does not show AIC and BIC weights. AIC/BIC weights are commonly used for model comparison and are calculated from the AIC/BIC values.
Implementation
Changes needed:
QML (inst/qml/RegressionLinear.qml):
modelAICBICWeightsfor "AIC and BIC weights"R (R/regressionlinear.R):
.linregCreateSummaryTable():modelAICBICWeights.linregFillSummaryTable():Calculation for AIC/BIC weights:
The weights are normalized so they sum to 1 across all models.
Test impact:
Test Results
Automated Code Review
Approved after 1 review iteration(s).