|
Curve FittingBasic InformationWe can fax you information if you want to know how any of the curve fits in KaleidaGraph are calculated. E-mail technical support with your fax number and the curve fit(s) of interest. The Linear, Polynomial, Exponential, Logarithmic, and Power curve fits in KaleidaGraph are calculated using the Least Squared Error method. Least Squares computes a set of coefficients to the specified function (in this case y = mx +b), that minimize the square of the difference between the original data and the predicting function. In other words, it minimizes the square of the error between the original data and the values predicted by the equation. If you only want to display the curve fit:
If you want to display all of the data points, but only fit a certain section of the curve:
The R value (linear correlation coefficient) is always reported as a positive value. This is because KaleidaGraph first calculates R^2, and then takes the square root to arrive at the value for R. Setting default font and font size for the curve fit equation table in v3.08 or later of KaleidaGraph:
Using the Undo Macro command undoes any curve fits that were applied. This information is not recoverable and the Redo command will not bring it back. This is a design decision that was made back in v1.1 of KaleidaGraph. Otherwise, there is a high probability of a System crash. Internally, the coefficients are stored in double precision format. The number of decimals displayed is determined by what is selected in the Equation Label Format dialog (Format menu). If you change the number of decimals, the curve fit is recalculated and the number of decimals in the coefficients will reflect the change. It is possible to apply a Linear curve fit and a General curve fit (using y=mx+b) to the same data and get slightly different results. This is because these fits use different methods to arrive at their results. It is valid to specify partial derivatives using Library definitions. Errors can only be displayed by using the General curve fit. If you want errors for any of the other fits, program that particular function into the General curve fit. General Curve FitThe errors that are displayed for the parameters are the standard error of the parameters. It can be read as the parameter value +/- the error. The Chi Square value in KaleidaGraph is the total sum of the squared errors. KaleidaGraph's General curve fit is based on the Levenberg-Marquardt algorithm. Our reference for this curve fit comes from Numerical Recipes in C , William H. Press, Brian P. Flannery, Saul A. Teukolsky, William T. Vetterling, Cambridge University Press. The section of this book which shows the formulas used in calculating the parameters and errors for the General curve fit is available in a .pdf format . If you would like a way to add new curve fits to your previously saved plots, you need v3.0.4 or later. The master list of fits were added to the Trash list in the Edit General dialog. To add curve fits from a saved plot to the master curve fit list:
Initial guesses for the Gaussian curve fit:
One way to fit two different equations is to combine them in a single curve fit definition using the if-else operator. If you had two functions such that: To force a linear fit to go through a particular Y value at X = 0 you have to use the general fit. For example if you wanted to have Y=4 at X=0 you would use the equation: Stretched exponential curve fits:
It is possible to include column numbers as part of the curve fit definition. In order to do this, you need to use the table command. For example, suppose you plotted c0 as X and c1 as Y and wished to use the values in c2 in the function: m1*m0^c2. Just using this equation would not work because the fit would not look at each of the values in c2. You need to replace c2 with table(m0, c0, c2). To use the table command, the X column must be sorted and there cannot be any duplicate values. The resulting definition would be: m1*m0^(table(m0,c0,c2)). For the weights to be used as part of the General curve fit, you should enter the actual error value for each point. So if you have a value of 10 and it has an error of 1.5, enter 1.5 into the column as the weight. Constants may be defined in the macro library and then used in a curve fit definition. For example, K=25 can be defined in the library. A curve fit definition of K+m1*m0 would be a valid definition. The error values do not reside in the same memory registers of the Macro Calc. after each curve fit. It actually depends on the number of parameters in the fit. The error for m1 is always stored in m30. To find the error for m2, add the total number of parameters to 30 and look in that register. After that you add the number of parameters and subtract 1 more than the last time. Here is a list of where they are stored for a 9 parameter fit: Smoothing FitsIt is not possible to extrapolate the various Smoothing fits to the axis limits because these fits do not result in an equation. This is because these fits cannot be represented by a single formula. The difference between the Cubic Spline and the Smooth curve fits:
ProblemsNo matter what type of curve fit you select (Power, Polynomial, etc.), KaleidaGraph draws a straight line on the graph:
[Tech Notes TOC]
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||