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 [Sun Oct 31 20:06:33 2010]
Gray
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.
  
-===== Fit Function is a Sum of Fit Curves ===== +==== Further reading ​==== 
-MagicPlot considers fit function as a **sum** of Fit CurvesOrdinarily in peaks fitting each Fit Curve corresponds ​to one peak in experimental data. There is number of predefined Fit Curves (Line, Parabola, Gauss, Lorentz, etc.) You can also specify a custom Fit Curve. Baseline fitting components may be added to the fitting sum, too.+This manual does not completely cover the complex nonlinear fitting methodologyWe recommend you to take look at this book:
  
-Fit Plot window contains the list of Fit CurvesEach Fit Curve in the list has three check boxes: ''​Show'',​ ''​Baseline''​''​Sum'':​ +  * HMotulsky and A. Christopoulos//Fitting Models to Biological Data Using Linear and Nonlinear RegressionA 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]].
-  * ''​Show''​Specifies whether ​to show this Fit Curve on plotActive only if Baseline check box is not set +
-  * ''​Baseline''​Toggles the subtracting of this Fit Curve from experimental data +
-  * ''​Sum'':​ Specifies whether to use this Fit Curve in sum fit function+
  
-Below the Fit Curves list is a parameter table which shows parameters names and values, and descriptions of selected Fit Curve.+{{:​fit_example.png?​nolink|Fit example}}
  
-===== Copying ​Fit Curves ​from One Fit Plot to Another ​===== +===== Fit Function is a Sum of Fit Curves ===== 
-You can copy and paste Fit Curves ​in curves table as usualUse context menu in curves table or press ''​Ctrl+C'', ​''​Ctrl+V''​ on PC and ''​Cmd C''​''​Cmd V''​ on Mac (curves table must have focusnot the plot itself). MagicPlot copies Fit Curves parameters valuesbaseline/​sum/​show checkbox values and style.+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 (LineParabolaGaussLorentz, etc.) You can also create a [[custom_fit_equation|Custom Equation]] Fit Curve and manually enter the formula (Pro edition only). Baseline fitting components may be added to the fitting sumtoo.
  
-===== Setting Initial Values ​of Parameters ===== +Fit Plot window contains the list of Fit Curves. ​Each Fit Curve in the list has three checkboxes:
-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.+{{:​curves_table.png?​nolink|Fit Curves ​table}}
  
-===== Parameter Locking ===== +  * ''​Show'':​ Specifies whether ​to show this Fit Curve on the plot. Active only if Baseline ​checkbox ​is not set 
-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.+  * ''​Baseline''​: Toggles the subtracting of this Fit Curve from experimental dataYou also can use ''​Residual''​ button to subtract all Fit Sum from data 
 +  * ''​Sum'':​ Specifies whether to use this Fit Curve in sum fit function
  
-===== Fit Intervals ===== +Below the Fit Curves list, is a parameters table which shows names, values, and descriptions ​of parameters relating ​to the selected Fit Curve.
-You can set the x intervals ​of the data. Data 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.+
  
-Select ​''​Fit Interval''​ tab to set intervals visually or edit accurate borders values: +==== Fitting by Sum and Fitting One Curve ==== 
-  * Double click on interval to split it +MagicPlot allows two alternatives buttons to run the fit: 
-  * Drag the interval border to move itIf intervals intersect, they will be merged +  * ''​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. 
-  * Use context menu on the plot to create, delete and split intervals+  * ''​Fit One Curve''​ button will fit the data with the one currently selected Fit CurveThe individual interval for each Fit Curve will be used. Set ''​Edit Interval''​ checkbox ​to edit individual interval for each Fit Curve.
  
-| {{:​interval_context_menu2.png|Interval context menu}} | {{:​interval_context_menu1.png|Interval context menu}} |+==== Copying and Pasting Fit Curves ==== 
 +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.
  
-===== Baseline Fitting and Extraction ===== +  * The copy of Fit Curves with the same parameters ​and styles will be created if you paste Fit Curves to a Fit Plot. 
-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 dataThen specify ​the whole interval and fit the data.+  * A link to the source Fit Curves will be inserted if you paste Fit Curves in a Figure.
  
-The most appropriate ​curve type for baseline fitting ​is [[spline|spline]].+==== Fit Curves Reordering ==== 
 +You can reorder Fit Curves by dragging them in the table. ​The data curve is always drawn the first and fit sum is drawn the last
  
-Note that if you execute one of data processing algorithms ​(integration,​ FFT, etc.on Fit Plot, then the difference between the data and baseline curves (which ​you do see on the plot) will be processedYou can use this behaviour to exclude baseline from data before integrating,​ see [[integration]] ​for more information.+===== Setting Initial Values of Parameters ===== 
 +Nonlinear fitting assumes ​that certain initial values of parameters are set before fitting. This 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.
  
-===== '​Data-Baseline'​ Table Column ===== +{{:​moving_curves.png?​nolink|Moving curves ​with mouse}}
-The '​Data-Baseline'​ column is appended to the Table with initial (x, y) fit 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).+
  
-It is 'Data-Baseline' ​column that is actually plotted on Fit Plot.+==== 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
  
-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.+===== Guessing Peaks ===== 
 +If you are fitting a spectrum with multiple peaks, MagicPlot 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.
  
-===== Fit One Curve ===== +===== Parameter Locking ​===== 
-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''​ tabis ignoredSelect ​''​Set Interval'' ​checkbox ​in the bottom of the Fit Plot panel to set specific fit intervals for each Fit Curve.+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.
  
-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.+{{:​parameters_table.png?​nolink|Table ​of Parameters}}
  
-===== Joining the Parameters ​of Fit Curves ​===== +===== Parameters ​Joining ​===== 
-In some cases you may want to fit the data with two Gauss or Lorentz peaks with the same width but different ​positions and amplitudes, for example. You can do this in two ways: by specifying custom ​Fit Curve with your equation or by //joining// the '​width'​ parameters of two peaks.+MagicPlot allows joining (sometimes referred ​to as coupling, binding, linking) of fit parameters of different Fit Curves. See [[joining]] for details.
  
-To join parameters ​of two or more Fit Curves select one of desired Fit Curves, select desired parameter in parameters table and press ''​Join''​ buttonAdd parameters which will be joint in the opened ​dialog ​windowJoined parameters ​are treated as one fit parameter.+===== Weighting ​of Data Points Using Y Errors ===== 
 +MagicPlot allows the weighting ​of data points with Y error dataYou can specify Y error data in Fit Plot properties ​dialog. ​If no Y error data are specified weighting is not used
  
-Joined parameters ​are shown with blue color (instead of black) in parameters table.+Weights ​are calculated as ''​1 / Y<​sub>​error</​sub><​sup>​2</​sup>''​ for every point. See [[fit_formulas]] for details.
  
-===== Fitting Algorithm ===== +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.
-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.+
  
-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>//​):+===== Specifying ​Fit Intervals ===== 
 +You can set the X intervals ​of the data which will be used for fittingData 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 endare inaccurate, e.g. noisy.
  
-<​m>​chi^2 = sum{i=1}{N}{w_i(y_i – f(x_i, beta_1, ..., beta_p))^2} right min</​m>​+Select ''​Fit Interval''​ tab to set intervals visually or edit accurate borders values in the table. 
 +  * Double click on the interval to split it 
 +  * Drag the interval border to move itIf intervals intersect, they will be merged 
 +  * Use context menu on the plot to createdelete and split intervals
  
-here: +**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.
-  ​//​x<​sub>​i</​sub>//​ and //​y<​sub>​i</​sub>//​ are the data points, +
-  ​//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>+{{:​interval_context_menu1.png?​nolink|Fit interval context menu}}
  
-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:+===== Baseline Fitting and Extraction ===== 
 +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.
  
-<​m>​{partial f}/{partial beta_m}(x_ibeta_1, ...beta_p)</m>+Note that if you use data processing ​(integrationFFTetc.) on Fit Plotthen the difference between the data and baseline curves (which you do see on the plotwill be processed. You can use this behavior to exclude baseline from data before integrating,​ see [[integration]] for more information.
  
-To start minimization,​ you have to provide an initial ​guess for the parameters+===== '​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.
  
-==== Fit Procedure Stop Criteria ==== +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.
-After each iteration except ​the first MagicPlot evaluates //deviation decrement D//:+
  
-<​m>​D ​delim{|} {{chi^2}_{curriter.} / {chi^2}_{previter.} – 1} {|}</​m>​+===== Viewing the Residual Plot ===== 
 +Residual means here the difference between initial data, baseline function and Fit Sum functionMagicPlot offers two different ways to view the residual: 
 +  * Press and hold the ''​Residual''​ buttonThe residual will be shown while the button is pressedYou 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
  
-Deviation decrement shows how the residual sum of squares ​(<​nowiki>​RSS</​nowiki>​on current iteration relatively differs from that on the previous iteration.+===== Fitting ===== 
 +To execute ​the fit click the ''​Fit by Sum''​ button ​of ''​Fit One Curve''​ button ​(see below).
  
-The iterative ​fit procedure stops on one of two conditions:​ +MagicPlot indicates the fit process with a special window. Fitting curves are periodically updated ​on the plot while fitting so you can see how fit converges.
-  * 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.png?​nolink|Fit progress window}}
  
-==== Fit progress window ==== +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.
- +
-MagicPlot indicates fit process with a special window. Fitting curves are periodically updated on plot while fitting so you can see how fit converges. +
- +
-{{:​iter.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 119: 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. +
- +
-===== Standard Deviation of Fit Parameters Calculation ===== +
-Standard deviations (//stddev.//) of fit parameters //​β<​sub>​k</​sub>//​ are evaluated after fit using the following formula: +
- +
-<​m>​s_k=sqrt{{chi^2}/​{N–p}[alpha^{–1}]_{k,​k}}</​m>​ +
- +
-here α is the matrix of partial derivatives of fit function by 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>​+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 ​(peaksand contain only noise.
  
-===== Undoing ​Fit ===== +{{:​fit_one_curve.png?​nolink|'​Fit One Curve' button}}
-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).+
  
-===== 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.//  | +
-| Standard deviation of the model  |  //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 |+
  
 ===== See Also ===== ===== See Also =====
 +  * [[fit_formulas]]
   * [[custom_fit_equation]]   * [[custom_fit_equation]]
   * [[spline]]   * [[spline]]
 +  * [[joining]]
   * [[guess_peaks]]   * [[guess_peaks]]
   * [[fit_equations]]   * [[fit_equations]]
-  * [[transform_xy]] 
   * [[interval_statistics]]   * [[interval_statistics]]
 +  * [[table_from_curves]]
fitting.1288544793.txt.gz · Last modified: Sun Nov 8 12:20:32 2015 (external edit)