Improve curve-fit reports, uncertainty handling, and results layout - #9
Open
paulnord wants to merge 21 commits into
Open
Improve curve-fit reports, uncertainty handling, and results layout#9paulnord wants to merge 21 commits into
paulnord wants to merge 21 commits into
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.
Curve-fit results now provide unit-bearing spreadsheet exports and experimental-physics fit statistics while keeping equal-weight least squares as the default. Expanding the report or changing the optional common measurement uncertainty does not change the best-fit coefficients.
Copy Fit Report now defaults to a compact classroom summary: model, equation, variable units, coefficients and errors, and the statistics shown on screen. The adjacent
...menu offers Copy Full Fit Report for the detailed analysis. Both retain full-precision spreadsheet cells.The full report explicitly identifies X/Y variables and units, observations, editable parameter count, independent parameter rank, rank-aware degrees of freedom, residual statistics, centered R Square, chi-square, and one full-precision parameter table. For example, quadratic position-versus-time coefficients have m/s^2, m/s, and m units, following KnownPolynomial's verified descending-degree parameter order. UserFunction parameter units are not guessed.
DataTable exports obtain units from existing metadata, not column-name parsing. Raw and formatted copies share unit-bearing headers while retaining their numeric serialization and delimiters. ASCII expressions replace display superscripts, and copy/paste does not append duplicate unit suffixes. Unitless columns retain their previous subscript normalization.
The compact optional uncertainty controls support:
Coefficient standard errors retain Tracker's Bevington Eq. 8.13 profile/refit curvature method. Supplied sigma changes its scale; it does not replace the method with Jacobian covariance. Redundant parameters retain N/A errors and an explicit identifiability warning. Perfect residual-estimated fits report undefined chi-square rather than 0/0; a supplied positive sigma permits zero chi-square and Q=1.
Centered R Square remains descriptive variance explained, with the existing caution about Excel's uncentered convention for some through-zero fits. Rank is based on normalized derivative columns with tolerance 1e-7; nonlinear interpretation is local. Valid classical polynomial ANOVA remains supplemental. No coefficient p-values or confidence intervals were added.
Earlier improvements in this PR remain: two significant uncertainty digits with matching coefficient precision, full-precision values for computation/export, immediate fixed/free parameter updates in Autofit, manual-mode preservation, a Copy Fit Report button, context-menu gestures that preserve Autofit, and compact fit information/statistics with stable layout during selection and resizing.
Validation of this revision:
Statistical definitions, metadata integration, limitations, and test instructions are in test/fit-report-physics.md and test/README.md. Dataset drawing error bars were inspected; a future per-point uncertainty column needs explicit selection-aligned mapping and is outside this change.
Uncertainty controls now explicitly label the default “Unweighted - estimate from residuals,” provide a wider separate value row, and distinguish pixel presets from physical units. Physical-unit starting values use one calibrated pixel (or residual scatter without calibration); switching supplied modes converts the current scale. Desktop layout tests check selector and value-field visibility and fractional-value entry width.
The display uses a single row for R-squared, SSE, and Residual SE; observation counts and degrees of freedom remain in copied reports. A scrolling fit panel preserves drawable graph space in small windows. The optional host position-versus-time metadata enables copied line-fit velocity and quadratic-fit velocity at t=0 and acceleration, with errors propagated by exact coefficient scaling. These derived results do not add duplicate on-screen rows. Arbitrary functions and unidentified column pairs do not receive physical labels.
Fit-uncertainty documentation is now arranged in three levels by audience:
+/-uncertainty mean, uncertainty choices, R-squared, reduced chi-square, and reporting. It begins from the principle that a number from a fit is not the answer; it is a measurement with assumptions attached.2.000 +/- 0.063 m/sexample.