# Plot: Fitting

Right-click on a plot and select Fitting from the shortcut menu to display the Fitting dialog box. You can also access these options via the Graph Options dialog box - Fitting tab (located under Plot). Use these options to fit plots to the data. Note that in order to access the Options box and Style list in the Fitting dialog box, you must first click the More button.

Note: For graphs, the model is assumed to be multiplicative. For the 2D Scatterplot model:

Y = b0 * exp(b1*x)*e

where e = error.

The model estimates the parameters via least squares, that is, it takes the log of Y.

Log(Y)=Log(b0)+b1*x+log(e).

Plot/Fit. Although all of the options are the same for each fit, you can make changes to each fit independently of the others. Select here the fit to which you want to make changes. If you have several plots in one graph, you can assign names to each plot using the Name option on the Plot: General tab. The two fields work together. For example, to edit the third fit in plot 2, set Plot to 2 and Fit to 3.

Add new fit/Delete. You can add a new fit by clicking the Add button. When you do this, a new fit will be added automatically to the Fit list box, and that new fit will be selected in the Fit list. To delete a fit, select the plot that has the fit in the Plot field and the fit you want to delete in the Fit field, and click the Delete button. Note that the options here are for deleting fits not plots. To delete plots, see the Plot: General tab.

Fit type. Depending on the type of graph you have, you can choose to fit a variety of distributions or one of several equations to the data in the plot by selecting one of the predefined functions in this dialog box. For more information on a particular fit, click the name below.

Fitting data. In the Scale box of the Fitting data group select the scale (axis values) to use in fitting the data. Use the Range box to choose one of three set ranges over which to plot the function. Choose Full range to calculate the selected fit using the entire range of data. Select Axis Range to calculate the fit using the entire range of the axis (i.e., using all points shown on the axis). For example, if the plotted variable contains values from 0 to 9, but your axis only shows values from 3-8, you can select Axis Range to calculate a fit using only the values between 3 and 8. To use all the values (including those which are not shown on the axis), you would select Full Range. Select Custom Range to calculate the fit using the range of values specified in the Min and Max fields.

Line. The options here determine the shape, size, color, and resolution of the fit line.

Pattern. Check the Pattern box if you want to have a line for the fit. You can customize the appearance of the line in the Line Properties dialog box, which is displayed by clicking the Pattern button. If you created a categorized scatterplot, this option will be the Multiple patterns button and, when clicked, will display the Category Overlay Fit Lines dialog box.

Resolution. This option is used to control the resolution of the fitted function in the graph. Once a fitted function has been determined, the fit is approximated with segments on the x-axis. The Normal fit line is composed of 200 segments, and the number of segments increases in exponential fashion as you select Medium, High, Very High, or Perfect. Note that this option is only beneficial for fits with high curvature (i.e., a straight line fit will not be improved by this option, but a high-level polynomial fit will be). Selecting a higher number of points will result in a smoother appearance of the fitted function in the graph; however, selecting a higher number of points will also slightly slow down the graphing procedure.

Options. When you fit a function to the data in a Statistica graph, several options are available to customize the fit. Note that different options are available (not dimmed) according to the Fit type selected. When customizing the fit from the Fitting dialog box, you must first click the More button in order to view these options.

Polynomial. When you select the Polynomial fitting function, you can select the order for the fitted polynomial. Choose either a second (Quadratic), third (Cubic), fourth (Quartic) or fifth (Quintic) order polynomial.

Logarithm base. When you select the Logarithmic function, you can select either the natural log (base e) or the base 10 logarithmic function.

No. of periods. When you select the Moving Average fitting function, you can specify the number of periods (values) to include in the moving average.

Exp Smooth Const. When you select the Exponential Smoothing fitting function, you can specify the exponential smoothing constant. This value must be between 0 and 1.

Stiffness. The function that controls the weight (see Distance-Weighted Least Squares Fitting) is determined by the Stiffness parameter, which can be modified here. Thus, the stiffness parameter determines the degree to which the fitted curve depends on local configurations of the analyzed values.

The lower the coefficient, the more the shape of the curve is influenced by individual data points (i.e., the curve "bends" more to accommodate individual values and subsets of values).

The range of the stiffness parameters is 0 < s < 1; if you specify values less than or equal to 0, or greater than or equal to 1, the respective fit line or surface may not be drawn in (may disappear from) the plot. Large values of the parameter produce smoother curves that adequately represent the overall pattern in the data set at the expense of local details. See also Negative Exponentially-Weighted Fitting. See also, McLain, 1974.

Value format. Click this button to display the Value Format dialog box, which is used to select from a variety of number formats to use including General, Number, Date, Time, Scientific, Currency, Percentage, Fraction or Custom.

Use default gaussian kernel bandwidth. This option is available when Gaussian Kernel is selected as the Fit type. Select this check box if you want to use the default Gaussian kernel bandwidth. The default bandwidth for a Gaussian kernel comes from Silverman (1986). It is defined as 0.9 * minimum(standard deviation, interquartile range/1.34) * n-1/5.

Bandwidth. If you choose to not use the default Gaussian kernel bandwidth, you can specify your own custom bandwidth. The bandwidth controls the amount of smoothing in the density estimation process. The density estimate is smoother for larger values of the bandwidth and less smooth for smaller values, which correspond to a more local representation of the density function.

Style. Instead of specifying line patterns in the Line box, you can select the style you want to use for this fit from the Style drop-down list box. To view a menu of options related to styles (Save, Save As, Revert to unmodified, etc.), click the button to the right of this box. For more on styles, see Graphics Styles - Overview.