Fit Plugins
Prev
Next

Fit Plugins

Kst provides lots of algorithms to perform data fitting. All fitting plugins output a vector of best fitted parameters, covariances, and Chi^2/Nu. These values can be seen by selecting the Data->View Fit Results

Note: The weight is not the same as the error. It is given as 1/yError^2.

Fit any non-linear function

This plugin is used to fit a set of data using the Levenberg-Marquardt algorithm.


non-linear fit

Inputs

X Array (vector)

The x array of the input data set

Y Array (vector)

The y array of the input data set

Formula y= (string)

The formula of the curve used to fit the data set

The default string is a*x^3 + b*x^2 - c*x +d

Parameters (string)

Use a string to specify the parameter representation letters in the fitting formula. The plugin will later output the fitted values for these parameters.

The default string is a, b, c, d corresponding to the default formula string.

Init values (string)

Use a string to specify the initial guess

The default string is 1, 1, 1, 1

Tolerance (scalar)

Tolerance is a number to indicate the precision of fitting; if the precision reaches the tolerance value, the curve fitting will stop.

The default tolerance is 1e-4.

Max iterations (scalar)

Specify the maximum number of iterations to indicate when the curve fitting should stop.

The default max iterations is 2.

Outputs

Y Fitted (vector)

The Y values of the fitted curve

Residuals (vector)

The array of residuals

Parameters (vector)

The best fitted values of the model parameters specified in the inputs.

Covariance (vector)

The covariance matrix of the model parameters, returned row after row in the vector.

chi^2/nu (scalar)

The sum of squares of residuals, divided by the degrees of freedom

Fit exponential weighted

The Fit exponential weighted plugin performs a weighted non-linear least-squares fit to an exponential model

An initial estimate of a=1.0, =0, and b=0 is used. The plugin subsequently iterates to the solution until a precision of 1.0e-4 is reached or 500 iterations have been performed.



Inputs

X Array (vector)

The array of x values for the data points to be fitted.

Y Array (vector)

The array of y values for the data points to be fitted.

Weights Array (vector)

The array of weights to use for the fit.

Outputs

Y Fitted (vector)

The array of fitted y values.

Residuals (vector)

The array of residuals.

Parameters (vector)

The best fit parameters a, , and b.

Covariance (vector)

The covariance matrix of the model parameters, returned row after row in the vector.

chi^2/nu (scalar)

The weighted sum of squares of the residuals, divided by the degrees of freedom.

Fit exponential

The Fit exponential plugin is identical in function to the Fit exponential weighted plugin with the exception that the weight value wi is equal to 1 for all index values i. As a result, the Weights (vector) input does not exist.

Fit Gaussian weighted

The Fit Gaussian weighted plugin performs a weighted non-linear least-squares fit to a Gaussian model:

An initial estimate of a=(maximum of the y values), =(mean of the x values), and =(the midpoint of the x values) is used. The plugin subsequently iterates to the solution until a precision of 1.0e-4 is reached or 500 iterations have been performed.



Inputs

X Array (vector)

The array of x values for the data points to be fitted.

Y Array (vector)

The array of y values for the data points to be fitted.

Weights Array (vector)

The array of weights to use for the fit.

Outputs

Y Fitted (vector)

The array of fitted y values.

Residuals (vector)

The array of residuals.

Parameters (vector)

The best fit parameters , , and a.

Covariance (vector)

The covariance matrix of the model parameters, returned row after row in the vector.

chi^2/nu (scalar)

The weighted sum of squares of the residuals, divided by the degrees of freedom.

Fit Gaussian

The Fit Gaussian plugin is identical in function to the Fit Gaussian weighted plugin with the exception that the weight value wi is equal to 1 for all index values i. As a result, the Weights (vector) input does not exist.

Fit gradient weighted

The gradient weighted plugin performs a weighted least-squares fit to a straight line model without a constant term:

The best-fit is found by minimizing the weighted sum of squared residuals:

for b, where wi is the weight at index i.



Inputs

X Array (vector)

The array of x values for the data points to be fitted.

Y Array (vector)

The array of y values for the data points to be fitted.

Weights Array (vector)

The array containing weights to be used for the fit.

Outputs

Y Fitted (vector)

The array of y values for the points representing the best-fit line.

Residuals (vector)

The array of residuals, or differences between the y values of the best-fit line and the y values of the data points.

Parameters (vector)

The parameter b of the best-fit.

Covariance (vector)

The estimated covariance matrix, returned row after row, starting with row 0.

Y Lo (vector)

The corresponding value in Y Fitted minus the standard deviation of the best-fit function at the corresponding x value.

Y Hi (vector)

The corresponding value in Y Fitted plus the standard deviation of the best-fit function at the corresponding x value.

chi^2/nu (scalar)

The value of the sum of squares of the residuals, divided by the degrees of freedom.

Fit gradient

The Fit linear plugin is identical in function to the Fit gradient weighted plugin with the exception that the weight value wi is equal to 1 for all index values i. As a result, the Weights (vector) input does not exist.

Fit linear weighted

The Fit linear weighted plugin performs a weighted least-squares fit to a straight line model:

The best-fit is found by minimizing the weighted sum of squared residuals:

for a and b, where wi is the weight at index i.



Inputs

X Array (vector)

The array of x values for the data points to be fitted.

Y Array (vector)

The array of y values for the data points to be fitted.

Weights Array (vector)

The array containing weights to be used for the fit.

Outputs

Y Fitted (vector)

The array of y values for the points representing the best-fit line.

Residuals (vector)

The array of residuals, or differences between the y values of the best-fit line and the y values of the data points.

Parameters (vector)

The parameters a and b of the best-fit.

Covariance (vector)

The estimated covariance matrix, returned row after row, starting with row 0.

Y Lo (vector)

The corresponding value in Y Fitted minus the standard deviation of the best-fit function at the corresponding x value.

Y Hi (vector)

The corresponding value in Y Fitted plus the standard deviation of the best-fit function at the corresponding x value.

chi^2/nu (scalar)

The value of the sum of squares of the residuals, divided by the degrees of freedom.

Fit linear

The Fit linear plugin is identical in function to the Fit linear weighted plugin with the exception that the weight value wi is equal to 1 for all index values i. As a result, the Weights (vector) input does not exist.

Fit Lorentz weighted

The Fit Lorentz weighted plugin performs a weighted non-linear least-squares fit to a Lorentzian model:

An initial estimate of a=(maximum of the y values), x0=(mean of the x values), and =(the midpoint of the x values) is used. The plugin subsequently iterates to the solution until a precision of 1.0e-4 is reached or 500 iterations have been performed.



Inputs

X Array (vector)

The array of x values for the data points to be fitted.

Y Array (vector)

The array of y values for the data points to be fitted.

Weights Array (vector)

The array of weights to use for the fit.

Outputs

Y Fitted (vector)

The array of fitted y values.

Residuals (vector)

The array of residuals.

Parameters (vector)

The best fit parameters x0, , and a.

Covariance (vector)

The covariance matrix of the model parameters, returned row after row in the vector.

chi^2/nu (scalar)

The weighted sum of squares of the residuals, divided by the degrees of freedom.

Fit Lorentz

The Fit Lorentz plugin is identical in function to the Fit Lorentz weighted plugin with the exception that the weight value wi is equal to 1 for all index values i. As a result, the Weights (vector) input does not exist.

Fit polynomial weighted

The Fit polynomial weighted plugin performs a weighted least-squares fit to a polynomial model:

where n is the degree of the polynomial model.



Inputs

X Array (vector)

The array of x values for the data points to be fitted.

Y Array (vector)

The array of y values for the data points to be fitted.

Weights Array (vector)

The array of weights to use for the fit.

Order (scalar)

The order, or degree, of the polynomial model to use.

Outputs

Y Fitted (vector)

The array of fitted y values.

Residuals (vector)

The array of residuals.

Parameters (vector)

The best fit parameters c0, c1,..., cn.

Covariance (vector)

The covariance matrix of the model parameters, returned row after row in the vector.

chi^2/nu (scalar)

The weighted sum of squares of the residuals, divided by the degrees of freedom.

Fit polynomial

The Fit polynomial plugin is identical in function to the Fit polynomial weighted plugin with the exception that the weight value wi is equal to 1 for all index values i. As a result, the Weights (vector) input does not exist.

Fit sinusoid weighted

The Fit sinusoid weighted plugin performs a least-squares fit to a sinusoid model:

where T is the specified period, and n=2+2H, where H is the specified number of harmonics.



Inputs

X Array (vector)

The array of x values for the data points to be fitted.

Y Array (vector)

The array of y values for the data points to be fitted.

Weights (vector)

The array of weights to use for the fit.

Harmonics (scalar)

The number of harmonics of the sinusoid to fit.

Period (scalar)

The period of the sinusoid to fit.

Outputs

Y Fitted (vector)

The array of fitted y values.

Residuals (vector)

The array of residuals.

Parameters (vector)

The best fit parameters c0, c1,..., cn.

Covariance (vector)

The covariance matrix of the model parameters, returned row after row in the vector.

chi^2/nu (scalar)

The weighted sum of squares of the residuals, divided by the degrees of freedom.

Fit sinusoid

The Fit sinusoid plugin is identical in function to the Fit sinusoid weighted plugin with the exception that the weight value wi is equal to 1 for all index values i. As a result, the Weights (vector) input does not exist.

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team