More stats fixes#114
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This has 3 fixes picked up by auditing CurveFit with Claude:
3572a9d:
margin_error()uses the model DOF to construct its t-distribution instead of the residual DOF. This was actually reported earlier in margin_error/confint use model dof instead of residual dof for the t critical value #107.22229fe: the nonlinear fits would compute the residuals as
ŷ − y, which is inconsistent with linear fits and different from the usual definition. Now they're computed asy - ŷ.942447a: so it turns out that Various parameter/stats fixes #112 wasn't sufficient to handle linear fits with a y-transform properly 😛
vcovwas computing the covariance for the original y-space parameters using the residuals, which is not consistent with how the parameters were estimated. In the case of the power/exp fits the log transform means we fit with multiplicative noise instead of additive noise (which a nonlinear fit would do). So now there's a specialvcovmethod to handle linear fits with a y-transform, which computes the covariance in the transformed space and then maps it back to the original space using the delta method.I'm no statistician so this should be reviewed carefully but the idea makes sense to me. We could alternatively accept the current design and document it appropriately, but this seems like the more correct approach.
Written with help from Claude 🤖
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.