Skip to content

More stats fixes#114

Merged
ChrisRackauckas merged 3 commits into
masterfrom
stats
Jun 28, 2026
Merged

More stats fixes#114
ChrisRackauckas merged 3 commits into
masterfrom
stats

Conversation

@JamesWrigley

@JamesWrigley JamesWrigley commented Jun 27, 2026

Copy link
Copy Markdown
Member

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 as y - ŷ.

  • 942447a: so it turns out that Various parameter/stats fixes #112 wasn't sufficient to handle linear fits with a y-transform properly 😛 vcov was 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 special vcov method 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

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

@JamesWrigley JamesWrigley self-assigned this Jun 27, 2026
@ChrisRackauckas ChrisRackauckas merged commit 6cc33ed into master Jun 28, 2026
22 checks passed
@ChrisRackauckas ChrisRackauckas deleted the stats branch June 28, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants