MagicPlot Manual

Plotting and nonlinear fitting software

User Tools

Site Tools


fitting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
fitting [Tue Feb 22 13:26:11 2011]
Alexander
fitting [Sun Jul 21 14:09:36 2019] (current)
Alexander
Line 1: Line 1:
 ====== Nonlinear Curve Fitting: Fit Plot ====== ====== Nonlinear Curve Fitting: Fit Plot ======
-Nonlinear least squares data fitting can be performed using Fit Plot. 
-To create a Fit Plot, select x and y columns in table, then select ''​Table -> Create Fit Plot''​ in main menu, or use context menu in table, or use Create Fit Plot button in the toolbar. 
  
-'​Nonlinear'​ means here that analytical fitting function depends nonlinearly on varying parameters (fit parameters). ​Linear fitting is a quite simple method, which is based on solving ​the system ​of linear equationsUnlike linear fitting, ​nonlinear fitting ​is performed by iterative ​algorithm ​which needs the user to set the initial values of fit parameters.+===== Creating a Fit Plot ===== 
 +Nonlinear least squares data fitting (nonlinear regression) can be performed using Fit Plot. 
 +To create a Fit Plot, select your X and Y columns in Table, then select ''​Table -> Create Fit Plot''​ in the main menu, or use the same item in the Table context menu, or use ''​Create Fit Plot''​ button in the toolbar. 
 + 
 +{{:​create_fit_plot_context_menu.png?​nolink|Creating Fit Plot using Table context menu}} 
 + 
 +==== MagicPlot has been verified with NIST Datasets ==== 
 +National Institute of Standards and Technology (NIST) has created the Statistical Reference Datasets Project which includes [[http://​www.itl.nist.gov/​div898/​strd/​nls/​nls_main.shtml|26 datasets]] for testing the nonlinear fit algorithms. MagicPlot has been successfully tested on these datasets. Our report on MagicPlot testing with NIST datasets is available here: [[http://​magicplot.com/​downloads/​MagicPlot-NIST-Test.pdf|Report]]. 
 + 
 +===== Fitting Methodology ===== 
 +'​Nonlinear'​ means here that analytical fitting function depends nonlinearly on varying parameters (fit parameters). ​ 
 +Fit procedure iteratively varies ​the parameters ​of the fit function to minimize the residual sum of squaresThe nonlinear fitting algorithm needs the user to set the initial values of fit parameters.
  
 To fit the data, implement these steps: To fit the data, implement these steps:
-  - Create a Fit Plot, specify ​y weighting ​in Plot properties, if any+  - Create a Fit Plot, specify ​Y errors ​in Data tab of Curve Properties dialog for the data curve, if any
   - Specify fit function by adding Fit Curves   - Specify fit function by adding Fit Curves
   - Specify initial values of fit parameters (drag curves or enter accurate values)   - Specify initial values of fit parameters (drag curves or enter accurate values)
-  - Specify used data interval+  - Specify used data interval
   - Run fitting   - Run fitting
  
-{{:​fit_example.png|Fit example}}+You can undo fit and also undo changing initial parameters as any other action using ''​Undo''​ function. It is a handy feature when experimenting with different models and initial parameters.
  
-===== Further reading ​=====+==== Further reading ====
 This manual does not completely cover the complex nonlinear fitting methodology. We recommend you to take a look at this book: This manual does not completely cover the complex nonlinear fitting methodology. We recommend you to take a look at this book:
  
-  * H. Motulsky and A. Christopoulos,​ //Fitting Models to Biological Data Using Linear and Nonlinear Regression: A Practical Guide to Curve Fitting.// 2003, GraphPad Software Inc., San Diego CA, graphpad.com. PDF is available [[http://​www.graphpad.com/​manuals/​prism4/​RegressionBook.pdf|here]].+  * H. Motulsky and A. Christopoulos,​ //Fitting Models to Biological Data Using Linear and Nonlinear Regression: A Practical Guide to Curve Fitting.// 2003, GraphPad Software Inc., San Diego CA, graphpad.com. PDF is available ​for free [[http://​www.graphpad.com/​manuals/​prism4/​RegressionBook.pdf|here]]. 
 + 
 +{{:​fit_example.png?​nolink|Fit example}}
  
 ===== Fit Function is a Sum of Fit Curves ===== ===== Fit Function is a Sum of Fit Curves =====
-MagicPlot considers fit function as a **sum** of Fit Curves. Ordinarily in peaks fitting each Fit Curve corresponds to one peak in experimental data. There is a number of predefined Fit Curves (Line, Parabola, Gauss, Lorentz, etc.) You can also specify ​custom ​Fit Curve. Baseline fitting components may be added to the fitting sum, too.+MagicPlot considers fit function as a **sum** of Fit Curves. Ordinarily in peaks fitting each Fit Curve corresponds to one peak in experimental data. Click the ''​Add''​ button to add new Fit Curve to the list. There is a number of predefined Fit Curves ​types (Line, Parabola, Gauss, Lorentz, etc.) You can also create ​[[custom_fit_equation|Custom Equation]] ​Fit Curve and manually enter the formula (Pro edition only). Baseline fitting components may be added to the fitting sum, too.
  
-Fit Plot window contains the list of Fit Curves. Each Fit Curve in the list has three checkboxes: ​''​Show'',​ ''​Baseline'',​ ''​Sum'':​ +Fit Plot window contains the list of Fit Curves. Each Fit Curve in the list has three checkboxes:
-  * ''​Show'':​ Specifies whether to show this Fit Curve on plot. Active only if Baseline checkbox is not set +
-  * ''​Baseline'':​ Toggles the subtracting of this Fit Curve from experimental data. You also can use ''​Residual''​ button to subtract Fit Sum from data +
-  * ''​Sum'':​ Specifies whether to use this Fit Curve in sum fit function+
  
-Below the Fit Curves ​list is a parameters ​table which shows names, values, and descriptions of parameters relating to selected Fit Curve.+{{:​curves_table.png?​nolink|Fit Curves table}}
  
-===== Copying Fit Curves from One Fit Plot to Another ===== +  * ''​Show''​: Specifies whether to show this Fit Curve on the plot. Active only if Baseline checkbox is not set 
-You can copy and paste Fit Curves in curves table as usual. Use context menu in curves table or press ''​Ctrl+C''​''​Ctrl+V'' ​on PC and ''​Cmd C''​''​Cmd V'' ​on Mac (curves table must have focus, not the plot itself). MagicPlot copies ​Fit Curves parameters values, baseline/sum/show checkbox values and style.+  * ''​Baseline''​: Toggles the subtracting of this Fit Curve from experimental data. You also can use ''​Residual'' ​button to subtract all Fit Sum from data 
 +  * ''​Sum''​: Specifies whether to use this Fit Curve in sum fit function
  
-===== Setting Initial Values of Parameters ===== +Below the Fit Curves list, is a parameters table which shows names, ​values, and descriptions ​of parameters ​relating to the selected ​Fit Curve.
-Nonlinear fitting assumes that certain initial ​values of parameters ​are set before fitting. This procedure is very easy if you use predefined ​Fit Curves: you can drag curves on plot.+
  
-Initial parameters values ​for each Fit Curve can also be set in parameter table.+==== Fitting by Sum and Fitting One Curve ==== 
 +MagicPlot allows two alternatives buttons to run the fit: 
 +  * ''​Fit by Sum''​ button will fit the data with the sum of Fit Curves for which the ''​Sum''​ checkbox is set. Data interval from ''​Fit Interval''​ tab will be used. This button must be used for example to fit the spectrum with the sum of peaks. 
 +  * ''​Fit One Curve''​ button will fit the data with the one currently selected Fit Curve. The individual interval ​for each Fit Curve will be used. Set ''​Edit Interval''​ checkbox to edit individual interval for each Fit Curve.
  
-===== Parameter Locking ===== +==== Copying and Pasting Fit Curves ​==== 
-You can lock parameter(s) to prevent varying this parameter during fit and to prevent its changing due to setting initial values by mouse dragging (for built-in functions)Set the checkbox in ''​Lock''​ column in parameters list.+You can copy and paste Fit Curves from one Fit Plot to another Fit Plot or FigureYou can also paste the copied Fit Curves to the same Fit Plot to create a copy.
  
-===== Fit Intervals ===== +  * The copy of Fit Curves with the same parameters and styles will be created if you paste Fit Curves to a Fit Plot. 
-You can set the x intervals of the dataData points outside these intervals are not used to compute ​the minimizing residual sum of squares (see below). You can use this feature ​if some data points (especially ​in the beginning or the end) are inaccurate, e.g. noisy.+  * A link to the source Fit Curves will be inserted ​if you paste Fit Curves ​in a Figure.
  
-Select ''​Fit Interval''​ tab to set intervals visually or edit accurate borders values: +==== Fit Curves Reordering ==== 
-  * Double click on interval to split it +You can reorder Fit Curves by dragging them in the tableThe data curve is always drawn the first and fit sum is drawn the last. 
-  * Drag the interval border to move itIf intervals intersect, they will be merged +
-  * Use context menu on the plot to create, delete ​and split intervals+
  
-| {{:​interval_context_menu2.png|Interval context menu}} | {{:interval_context_menu1.png|Interval context menu}} |+===== Setting Initial Values of Parameters ===== 
 +Nonlinear fitting assumes that certain initial values of parameters are set before fittingThis procedure is very easy if you use Fit Curves of predefined types (not custom equation)you can drag curves on the plot. Initial parameters values for each Fit Curve can also be set in the parameter table.
  
-===== Baseline Fitting and Extraction ===== +{{:​moving_curves.png?​nolink|Moving curves with mouse}}
-Fit Interval is also usable when baseline fitting. Before baseline fitting you can specify the interval which does not contain any signal points and contains baseline only. Set ''​Baseline''​ checkboxes at baseline Fit Curves after baseline fitting to subtract baseline from data. Then specify the whole interval and fit the data.+
  
-The most appropriate curve type for baseline fitting ​is [[spline|spline]].+==== Adjusting Parameters with Mouse Wheel ==== 
 +You can adjust Parameters in the table using mouse wheel scrolling when the mouse cursor ​is on the desired parameter: Hold Ctrl key (Cmd key on Mac) and scroll. If the Shift key is also pressed the parameter step for one wheel '​click'​ will be increased
  
-Note that if you execute one of data processing algorithms (integrationFFT, etc.) on Fit Plot, then the difference between the data and baseline curves ​(which you do see on the plotwill be processedYou can use this behaviour to exclude baseline from data before integrating,​ see [[integration]] for more information.+===== Guessing Peaks ===== 
 +If you are fitting a spectrum with multiple peaksMagicPlot may automatically add and approximately locate peaks before fitting ​(Pro edition only). See [[guess_peaks]] for details. Guessed peaks should be used only as of the initial estimate for fitting: don't forget to click the Fit button after peaks are added.
  
-===== '​Data-Baseline'​ Table Column ​===== +===== Parameter Locking ​===== 
-The '​Data-Baseline'​ column is appended ​to the Table with initial (x, yfit data when you create Fit Plot The '​Data-Baseline'​ column contains ​the difference between initial y data and baseline approximation (the sum of Fit Curves for which ''​Baseline'' ​checkbox is set).+You can lock (fix) parameter(s) ​to prevent varying this parameter(s) during ​the fit and to prevent its changing due to set initial ​values by mouse dragging ​(for built-in functions). Set the checkbox in ''​Lock'' ​column in the parameter list to lock parameter.
  
-It is '​Data-Baseline'​ column that is actually plotted on Fit Plot.+{{:​parameters_table.png?​nolink|Table of Parameters}}
  
-Use '​Data-Baseline'​ column in Table if you want to process the data without baseline. This column is also used as initial data if you use ''​Processing''​ menu when Fit Plot is active.+===== Parameters Joining ===== 
 +MagicPlot allows joining (sometimes referred ​to as coupling, binding, linking) of fit parameters of different ​Fit Curves. See [[joining]] for details.
  
-===== Viewing the Difference between ​Data and Fit Sum Function (Residual) ​===== +===== Weighting of Data Points Using Y Errors ​===== 
-MagicPlot ​offers two different ways to view the difference between ​data and Fit Sum function: +MagicPlot ​allows ​the weighting of data points with Y error dataYou can specify Y error data in Fit Plot properties dialogIf no Y error data are specified weighting ​is not used
-  * You can set ''​Baseline''​ checkboxes for all fit function components to subtract them from data and explore the residual plot +
-  or  +
-  * You can press and hold ''​Residual''​ button. The difference between ​data and Fit Sum function is shown while button is pressedYou can use either mouse or space key (if button ​is selected) to hold ''​Residual''​ button.+
  
-===== Fit One Curve ===== +Weights are calculated as ''​1 / Y<​sub>​error</​sub><​sup>​2</​sup>​''​ for every pointSee [[fit_formulas]] ​for details.
-You can also use MagicPlot to fit the data with single selected Fit Curve by pressing ​''​Fit One Curve'' ​button. In this case a specific data interval ​for each Fit Curve is used and the main fitting data interval (set in ''​Fit Interval''​ tab) is ignoredSelect ''​Set Interval''​ checkbox in the bottom of the Fit Plot panel to set specific fit intervals ​for each Fit Curve.+
  
-Because of using individual data interval this method is useful ​for baseline fitting. In order to fit baseline specify ​the intervals which does not contain signal ​(peaks) and contain only noise.+Weights must be positive and finite ​for all points so the Y error values must be positive and non-zero ​(to prevent infinite weights). MagicPlot checks this condition before fitting ​and shows an error message if Y errors cannot be used to compute weights.
  
-===== Joining the Parameters of Fit Curves ​===== +===== Specifying ​Fit Intervals ​===== 
-MagicPlot allows coupling ​of fit parameters. See [[joining]] ​for details.+You can set the X intervals ​of the data which will be used for fitting. Data points outside these intervals are not used to compute the minimizing residual sum of squares. You can use this feature if some data points (especially in the beginning or the end) are inaccurate, e.g. noisy.
  
-===== Fitting Algorithm ===== +Select ''​Fit Interval''​ tab to set intervals visually or edit accurate borders values ​in the table. 
-MagicPlot uses iterative [[wp>​Levenberg–Marquardt_algorithm|Levenberg–Marquardt]] [[wp>​Non-linear_least_squares|nonlinear least squares]] curve fitting algorithm which is widely used in most software.+  * Double click on the interval to split it 
 +  * Drag the interval border to move it. If intervals intersect, they will be merged 
 +  * Use context menu on the plot to create, delete and split intervals
  
-Fit procedure iteratively varies ​the parameters //​β<​sub>​k</​sub>//​ of fit function //f//(//x, β<​sub>​1</​sub>, ​..., β<​sub>​p</​sub>//​) to minimize the residual sum of squares (<​nowiki>​RSS</​nowiki>,​ //​χ<​sup>​2</​sup>//​):​+**Note:** Data intervals from the ''​Fit Interval''​ tab are used for fitting Sum only. To set individual data intervals for the one Curve fitting use ''​Edit Interval''​ checkbox.
  
-<​m>​chi^2 = sum{i=1}{N}{w_i(y_i – f(x_i, beta_1, ..., beta_p))^2right min</​m>​+{{:​interval_context_menu1.png?​nolink|Fit interval context menu}}
  
-here: +===== Baseline Fitting ​and Extraction ===== 
-  * //​x<​sub>​i</​sub>// ​and //​y<​sub>​i</​sub>//​ are the data points, +Fit Interval ​is also usable when baseline fittingBefore baseline fittingyou can specify ​the interval ​which does not contain any signal points and contains baseline only. Set ''​Baseline''​ checkboxes at baseline Fit Curves after baseline fitting to subtract baseline from data. Then specify the whole interval ​and fit the data.
-  * //N// is total number of points, +
-  * //f//(//x, β<​sub>​1</​sub>,​...,β<​sub>​p</​sub>//​) is the fit function ​which depends on value of //x// and fit parameters //​β<​sub>​k</​sub>//,​ +
-  * //p// is the number of fit parameters //​β<​sub>​k</​sub>//,​  +
-  * //​w<​sub>​i</​sub>//​ are normalized //y// data weighting coefficients for each point y<​sub>​i</​sub>:​+
  
-<​m>​sum{i=1}{N}{w_i} = 1</m>+Note that if you use data processing (integration,​ FFT, etc.) on Fit Plot, then the difference between the data and baseline curves (which you do see on the plot) will be processed. You can use this behavior to exclude baseline from data before integrating,​ see [[integration]] for more information.
  
-Calculation of the new guess of parameters on each fit iteration ​is based on the fit function partial derivatives for current values of fit parameters ​and for each x value:+===== '​Data-Baseline'​ Table Column ===== 
 +The '​Data-Baseline'​ column ​is appended to the Table with initial (X and Y) data when you create a Fit Plot. The '​Data-Baseline'​ column contains the difference between initial Y data and baseline approximation (the sum of Fit Curves ​for which ''​Baseline''​ checkbox is set). It is '​Data-Baseline'​ column that is actually plotted on Fit Plot as data.
  
-<​m>​{partial f}/{partial beta_m}(x_i,​ beta_1, ​..., beta_p)</​m>​+Use '​Data-Baseline'​ column in Table if you want to process the data without baselineThis column is also used as initial data if you use ''​Processing''​ menu when Fit Plot is active.
  
-To start minimizationyou have to provide an initial guess for the parameters+===== Viewing the Residual Plot ===== 
 +Residual means here the difference between initial databaseline function and Fit Sum function. MagicPlot offers two different ways to view the residual: 
 +  * Press and hold the ''​Residual''​ buttonThe residual will be shown while the button is pressed. You can use either mouse or space key (if the button is selected) to hold ''​Residual''​ button. 
 +  * You can either set ''​Baseline''​ checkboxes for all summed Fit Curves to subtract them from data and explore the residual plot
  
-==== Fit Procedure Stop Criteria ​==== +===== Fitting ===== 
-After each iteration except ​the first MagicPlot evaluates //deviation decrement D//:+To execute ​the fit click the ''​Fit by Sum''​ button of ''​Fit One Curve''​ button (see below).
  
-<m>D = delim{|} {{chi^2}_{curriter.} / {chi^2}_{prev. iter.} – 1} {|}</​m>​+MagicPlot indicates the fit process with a special windowFitting curves are periodically updated on the plot while fitting so you can see how fit converges.
  
-Deviation decrement shows how the residual sum of squares (<​nowiki>​RSS</​nowiki>​) on current iteration relatively differs from that on the previous iteration.+{{:​fit_progress.png?​nolink|Fit progress window}}
  
-The iterative fit procedure stops on one of two conditions:​ +MagicPlot shows the current iteration number and deviation decrement with two progress bars while the fit is performed. The fit process stops when one of these progress bars reaches the end.
-  * If the deviation decrement //D// is less than minimum allowable deviation decrement, which is 10<​sup>​-9</​sup>​ by default +
-or (and) +
-  * If the number of iterations exceeds maximum number of iterations, which is 100 by default +
- +
-You can change the minimum allowable deviation decrement and maximum number of iterations in Fitting tab of MagicPlot Preferences. +
- +
-===== Fit Progress Window ===== +
- +
-MagicPlot indicates fit process with a special window. Fitting curves are periodically updated on plot while fitting so you can see how fit converges. +
- +
-{{:​fit_progress.png|Fit progress window}} +
- +
-MagicPlot shows current iteration number and deviation decrement with two progress bars while fit is performed. The fit process stops when one of these progress bars reaches the end.+
  
 You can see two buttons on fit progress window: You can see two buttons on fit progress window:
Line 126: Line 123:
   * ''​Undo Fit'':​ Breaks iterations and reverts fit parameters to their initial (before fit) values. Use this button if you see that fit process converges to wrong result; change initial values of parameters and run fit again.   * ''​Undo Fit'':​ Breaks iterations and reverts fit parameters to their initial (before fit) values. Use this button if you see that fit process converges to wrong result; change initial values of parameters and run fit again.
  
-===== Weighting of y data ===== +===== Fitting One Curve ===== 
-MagicPlot ​can use weighting of //y// values based on y errors //​s<​sub>​i</​sub>//:​ +You can use MagicPlot ​to fit the data with single selected Fit Curve by pressing ​''​Fit ​One Curve'' ​button. In this case, a specific data interval for each Fit Curve is used and the main fitting data interval ​(from ''​Fit Interval''​ tab) is ignored. Select ''​Edit Interval''​ checkbox in the bottom ​of the Fit Plot panel to set specific fit intervals ​for each Fit Curve.
-  * If standard //y// errors are **not** specified: all //​w<​sub>​i</​sub>//​=1 +
-  * If standard //y// errors //​s<​sub>​i</​sub>//​ are specified:  +
- +
-<​m>​w_i=C 1/​{{s_i}^2}</​m>​ +
- +
-here //C// is normalizing coefficient (to make the sum of //​w<​sub>​i</​sub>//​ be equal to one): +
- +
-<​m>​C=sum{i=1}{N}{{s_i}^2}</​m>​ +
- +
-In ''​Fit ​Plot Properties'' ​dialog ​(''​Plot Data''​ tab) you can set one of the following methods ​to evaluate standard y errors //​s<​sub>​i</​sub>//:​ +
-  * Get y errors from table column(s),​ +
-  * Percent of data for every point, +
-  * Fixed value or Standard deviation --- do not use in weighting because in this case the error values are the same for all data points. +
- +
-===== Undoing ​Fit ===== +
-You can undo fit and undo changing initial parameters as usual using Undo function. It is a handy feature when experimenting with different models and initial parameters (e.g. peaks positions).+
  
 +Because of using individual data interval this method is useful for baseline fitting. In order to fit baseline specify the intervals which do not contain signal (peaks) and contain only noise.
  
 +{{:​fit_one_curve.png?​nolink|'​Fit One Curve' button}}
  
-===== Formulas ​===== +===== Why My Fit is Not Converged? ​===== 
-In the table below you can find the formulas which MagicPlot uses to calculate ​fit parameters ​and values ​in ''​Fit Report''​ tab.+In some cases, ​the fit procedure may fail to find the optimal parameters values. The actual mathematical reason for this error is the impossibility to invert the matrix α calculated from partial derivatives of the fit function with respect ​to fit parameters. This inverted matrix is used to compute the new values ​of parameters for the next step of fit (like gradient descent). In most cases, this error occurs when the matrix α is ill-conditioned or nearly singular and the inverse cannot be calculated accurately enough with used floating-point arithmetic
  
-Because ​of some confusion in the names of the parameters in different sources ​(books and software), we also give many different names of same parameter ​in //note// column.+=== The origin ​of this error may be: === 
 +  * Fit is not converged through one or more parameters: ​some parameters were taking unrealistically great values during iterations. There is no local minimum of residual sum of squares near the initial values of these parameters. MagicPlot highlights the suspicious Fit Curve in this case. 
 +  * Mutual dependency exists between some parameters. The algorithm cannot resolve which parameter to vary. 
 +  * Fit function is ill-conditioned:​ the minimized residual sum of squares depends on some parameters much more than on other ones. 
 +  * Numeric overflow ​(or underflowwhen calculating fit function with initial ​parameter ​values or on the next steps.
  
-^  Parameter Name  ^  Symbol ​ ^  Formula ​ ^  Note  ^ +=== Try one of the following: ​=== 
-^ Original Data and Fit Model Properties ​ ^^^^ +  ​* Specify more accurate initial values ​of parameters. 
-| Number ​of used data points ​ |  <​m>​N</​m> ​ |  ---  | This is the number of data points inside specified Fit Interval. ​ | +  ​* Simplify ​the fit function (e.gremove some peaks). 
-| Fit parameters ​ |  //​β<​sub>​1</​sub>,​...,​β<​sub>​p</​sub>// ​ |  ---  | For peak-like functions (Gauss, Lorentz) these parameters are amplitude, position and half width at half maximum. ​ | +  ​* Lock some parameters.
-| Number of fit function parameters //β// |  <​m>​p</​m> ​ |  ---  | This is the total number of parameters of all fit curves which are summarized to fit.  | +
-| [[wp>​Degrees_of_freedom_(statistics)|Degrees of freedom]] ​ |  <​m>​nu</​m> ​ |  <​m>​N–p</​m> ​ | | +
-| Estimated mean of data |  <​m>​overline{y}</​m> ​ |  <​m>​1/​N sum{i=1}{N}{y_i}</​m> ​ | | +
-| Estimated variance of data |  <​m>​s^2</​m> ​ |  <​m>​1/​{N–1} sum{i=1}{N}{(y_i – overline{y})^2}</​m> ​ | Not used by fit algorithm, only for comparison. | +
-| Data total sum of squares, TSS  |  TSS  |  <​m>​sum{i=1}{N}{w_i(y_i – overline{y})^2}</​m> ​ | //TSS is also called sum of squares about the mean and acronym SST is also used.// ​ | +
-^ Fit Result ​ ^^^^ +
-| Residual sum of squares, <​nowiki>​RSS</​nowiki> ​ |  <​m>​chi^2</​m> ​ |  <​m>​sum{i=1}{N}{w_i(y_i – f(x_i,​beta_1,​...,​beta_p))^2}</​m> ​ | This value is minimized during the fit to find the optimal fit function ​parameters. ​\\ //<​nowiki>​RSS</​nowiki>​ is also called the sum of squared residuals (SSR), the error sum of squares (ESS), the sum of squares due to error (SSE).// ​ | +
-| Reduced //​χ//<​sup>​2</​sup> ​ |  <​m>​{{chi^2}_{red.}}</​m> ​ |  <​m>​{chi^2}/​nu = {chi^2}/​{N–p}</​m> ​ | The advantage of the reduced chi-squared is that it already normalizes for the number of data points and model (fit function) complexity. \\ //Reduced χ<​sup>​2</​sup>​ is also called mean square error (MSE) or the residual mean square.//  | +
-| Residual Standard Deviation ​ |  //s//  |  <​m>​sqrt({chi^2}_{red.})</​m> ​ | //Standard deviation is also called root mean square of the error (Root MSE)// | +
-| [[wp>​Coefficient_of_determination|Coefficient of determination]] ​ |  <​m>​R^2</​m> ​ |  <m>1 – {chi^2}/​TSS</​m> ​ | //​R//<​sup>​2</​sup>​ will be equal to one if fit is perfect, and to zero otherwise. This is a biased estimate of the population //​R//<​sup>​2</​sup>,​ and will never decrease if additional fit parameters (fit curvesare added, even if they are irrelevant| +
-| Adjusted //​R//<​sup>​2</​sup> ​ |  <​m>​overline{R}^2</​m> ​ |  <m>1 – {N–1}/​{N–p–1}(1–R^2)</​m> ​ | Adjusted //​R//<​sup>​2</​sup>​ (or //degrees of freedom adjusted R-square//) is a slightly modified version of //​R//<​sup>​2</​sup>,​ designed to penalize for the excess number of fit parameters ​(fit curves) which do not add to the explanatory power of the regressionThis statistic is always smaller than //​R//<​sup>​2</​sup>,​ can decrease as you add new fit curves, and even be negative for poorly fitting models | +
-| Covariance Matrix of Parameters //​β<​sub>​k</​sub>//​ |  <​m>​Sigma</​m> ​ |  <​m>​{chi^2}/​{N–p} alpha^{–1}</​m> ​ | Here α is the matrix of partial derivatives of fit function with respect to parameters //​β<​sub>​m</​sub>//​ and //​β<​sub>​n</​sub>//​ which is used for fitting:\\ <​m>​alpha_{m,​n}=sum{i=1}{N}{w_i {{partial f}/{partial beta_m}(x_i,​ beta_1, ..., beta_p) {partial f}/{partial beta_n}}{(x_i,​ beta_1, ..., beta_p)}}</​m> ​ |  +
-| Standard Deviation of Parameters //​β<​sub>​k</​sub>//,​\\ std. dev.  |  <​m>​s_k</​m> ​ |  <​m>​sqrt{Sigma_{k,​k}}</​m> ​ |   |  +
-| Correlation Matrix of Parameters //​β<​sub>​k</​sub>//​ |  <​m>​C</​m> ​ |  <​m>​C_{i,​j}=Sigma_{i,​j} / {s_i s_j}</​m> ​ |   ​| ​+
  
 ===== See Also ===== ===== See Also =====
 +  * [[fit_formulas]]
   * [[custom_fit_equation]]   * [[custom_fit_equation]]
   * [[spline]]   * [[spline]]
Line 177: Line 151:
   * [[guess_peaks]]   * [[guess_peaks]]
   * [[fit_equations]]   * [[fit_equations]]
-  * [[transform_xy]] 
   * [[interval_statistics]]   * [[interval_statistics]]
 +  * [[table_from_curves]]
fitting.1298370371.txt.gz · Last modified: Sun Nov 8 12:20:32 2015 (external edit)