The QtiPlot Handbook
Prev | Chapter 5. The Dialogs | Next

# The Fit Wizard

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.

Figure 5-46. The first step of the Fit Wizard... dialog box.

This first step is used to define the function which will be used for fitting. When you are ready to perform the fit, click on the button to activate the Fitting Session.

The second step is to define the parameters for the fit. You have to give an initial guess for the fitting parameters.

Figure 5-47. The second step of the Fit Wizard... dialog box.

This second step is used to define the parameters of the fit.

In this second tab you can also choose a weighting method for your fit (the default is No weighting). The available weighting methods are:

1. No weight: all weighting coefficients are set to 1 (wi = 1).

2. 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 Y-error bars to the analyzed curve before performing the fit.

3. Statistical: the weighting coefficients are calculated as wi = 1/yi, where yi are the y values in the fitted data set.

4. 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.

5. 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-48. The third step of the Fit Wizard... dialog box.

This third step is used to customize the output of a fitting operation.

This dialog tab provides controls that can be used to evaluate the goodness of fit. The first is the Residuals Plot button which is used to display the curve of the plot residuals. The Conf. Bands and Pred. Bands buttons can be used to generate confidence and prediction limits for the current fit, based on the user input confidence value.

After the fit, a series of fit statistics are displayed in the log window allowing evaluation of the goodness of fit. These values are:

1. Chi^2/doF
2. R-square
3. Adjusted R-square
4. RMSE (Root Mean Squared Error)
5. RSS (Residual Sum of Squares)

For detailed explanations about the meaning of this statistical values, please visit the following link.

By default, reported errors are not automatically scaled by the square root of the reduced chi-squared value. You can choose to enable this option by checking the Scale errors with sqrt(Chi^2/doF) box.

Prev | Home | Next
Integrate Function Dialog | Up | General Plot Options