This dialog is activated by selecting the command Fit Wizard... from the Analysis Menu. This command is active if a plot or a table window is selected. In the latter case, this command first creates a new plot window using the list of selected columns in the table.
This dialog is used to fit discrete data points with a mathematical function. The fitting is done by minimizing the least square difference between the data points and the Y values of the function.
The top of the dialog box is used to select one of 4 Categories of functions: 1) user defined functions which have been previously saved, 2) the classical functions provided by QtiPlot in the analysis menu, 3) simple elementary (basic) built-in functions, and 4) external functions provided via plugins.
To choose a function, first select a category and then the desired function from the displayed Function list. Clicking on the checkbox under the selector will clear the contents of the function entry text pane (see below) and copy the selected function into it. You can also click the Add expression button to copy the selected function, but this will not clear any previous contents. If you've selected one of the "basic" functions, there will be no checkbox and you will need to use the Add expression button.
The bottom half of the dialog box allows you to define your own function. You can either write you own mathematical expression from scratch or add expressions from the function selector with the Add expression button. Once a custom expression is completed, clicking on the Save button will add the function to the list of user defined functions. The Name field will be used as the name of the function. A copy of the function is saved on disk with the extension ".fit". You can define the folder where ".fit" files are saved using either the Choose models folder... button (shown only when "User defined" is selected) or by selecting a new folder in the Save file dialog. Functions can be removed from the User Defined list by selecting them and clicking on the Remove button. You will be asked to confirm the deletion.
The second step is to define the parameters for the fit. You have to give an initial guess for the fitting parameters.
Figure 5-105. The second step of the Fit Wizard... dialog box.
In this second tab you can also choose a weighting method for your fit (the default is No weighting). The available weighting methods are:
No weight: all weighting coefficients are set to 1 (wi = 1).
Instrumental: the values of the associated error bars are used as weighting coefficients wi = 1/eri2, where eri are the error bar sizes stored in error bar columns. You must add error bars to the analyzed curve before performing the fit.
Statistical: the weighting coefficients are calculated as wi = 1/yi, where yi are the y values in the fitted data set.
Arbitrary Dataset: allows setting the weighting coefficients using an arbitrary data set wi = 1/ci2, where ci are the values in the arbitrary data set. The column used for the weighting must have a number of rows equal to the number of points in the fitted curve.
Direct Weighting: allows setting the weighting coefficients using an arbitrary data set wi = ci, where ci are the values in the arbitrary data set. The column used for the weighting must have a number of rows equal to the number of points in the fitted curve.
After the fit, the log window is opened to show the results of the fitting process.
Depending on the settings in the Custom Output tab, a function curve (option Uniform X Function) or a new table (if you choose the option Same X as Fitting Data) will be created for each fit. The new table includes all the X and Y values used to compute and to plot the fitted function and is hidden by default. It can be found in and viewed from the project explorer.
Figure 5-106. The third step of the Fit Wizard... dialog box.
The options in the Curves group box can be used to specify if some additional plot curves should be generated after each fit operation. If the Conf. Bands and Pred. Bands options are checked QtiPlot generates confidence bands and prediction bands for the current fit, based on the user defined value for the confidence level. If the Residuals Plot option is checked the curve of the fit residuals is also displayed. The residuals are calculated as the difference between the experimental Yi values and the response values predicted by the fit model.
The controls in the Parameters Output group box can be used in order to define the options for the display of the results from data fit operations. The Format list box allows to choose a default numerical format. The value of the Significant Digits option can be used to customize the precision of the output and has a different meaning depending on the numeric format. The following format and precision options are available:
- Decimal or scientific e-notation, whichever is the most concise. The value of the Significant Digits control represents the maximum number of significant figures in the output (trailing zeroes are omitted).
- Decimal notation. The value of the Significant Digits control represents the number of digits after the decimal point.
- Scientific e-notation where the letter
e is used to represent "times ten raised to the power of" and is followed by the value of the exponent. The value of the Significant Digits control represents the number of digits after the decimal point.
The errors on the fit parameters are displayed in the log window only if the Error box from the Results Log group is checked. The Scale Errors with sqrt(Chi^2/doF) option only affects the errors on the parameters reported after the fit operation. It does not affect the fitting process or the data in any way. If checked, the reported errors on the parameters, εj, are calculated as the square root of the diagonal elements of the covariance matrix Cov(j, j) multiplied with sqrt(Chi2/(n - p)), where n is the number of data points and p the number of fit parameters. Otherwise, the reported errors equal the square root of the diagonal elements of the covariance matrix Cov(j, j).
If the LCL and UCL options from the Results Log group box are checked QtiPlot also displays the confidence limits for each fit parameter based on the value of the confidence level specified in the Curves box.
After the fit, a series of statistics are displayed in the log window allowing evaluation of the goodness of fit. The controls in the Statistics group box can be used to specify which of these fit statistics should be displayed by default. For more details about these values please visit the Data fiting section from the chapter dedicated to the Analysis of data and curves.