Functions > Data Analysis > Curve Fitting > LeastSquaresFit and Confidence Functions
LeastSquaresFit and Confidence Functions
LeastSquaresFit(vx, vy, F, guess, conf, [Stdy], [LBUB], [Acc])—Returns parameters and their confidence limits for the nonlinear fitting function F for the data vx and vy, for a confidence level conf, with optional standard deviations Stdy and optional lower and upper bounds on acceptable parameter values to accuracy Acc.
The first column of the output of the LeastSquaresFit function contains the values for the fitted parameters. The remaining two columns contain the left and right boundaries for the confidence interval on the parameters.
If you are using more than one of the optional arguments, they must be specified in their relative order shown above.
confidence(vx, vy, F, b, conf)—Returns the confidence limits on the parameters b of a fitting function F(x, b) for the data vx and vy.
The first column of the output of the confidence function contains the variance on the value of each parameter. The first element of the second column contains the percent point function value of the t distribution used to calculate the intervals. The remaining elements in the second column are zeroes.
For finding the lower or upper limit of the confidence interval for each parameter, you can substract or add the first column from the output of the confidence function from the vector of parameter values.
Arguments
vx, vy are vectors of real data values of the same length, corresponding to the x and y values in the data set.
F(x, b) is a fitting function of one variable with an arbitrary number of parameters, b.
The number of parameters cannot exceed the length of vx.
You must define the function F before calling LeastSquaresFit or confidence.
You can specify the function F(x, b) with b as a vector, or with a series of scalar variables in the function's argument list.
When entering the fitting function argument, write only the name of the fitting function (write F instead of F(x, b)).
guess is a guess vector with one guess value for each parameter.
conf is the desired confidence limit, a percentage expressed as a number between 0 and 1, inclusive.
Stdy (optional) is a vector of standard deviations in y. Stdy must be the same length as vy.
LBUB (optional) is a two-column matrix of lower and upper bounds on the parameters, with m + n rows.
Acc (optional) is a convergence accuracy. The default value for Acc is 10–7.
b is a vector of real values, corresponding to the values of the parameters of the fitting function F.
Was this helpful?