GoodnessOfFit

Advanced Analysis Library Only

AnalysisLibErrType GoodnessOfFit (double observations[], double fittedData[], double weight[], int numberOfElements, int degreeOfFreedom, double *sse, double *rSquare, double *rmse);

Purpose

Calculates three parameters, sse, rSquare, and rmse, which describe how well a fitted model matches the original data set. This function uses the following calculations:

where is the mean value of observations.

Parameters

Input
Name Type Description
observations double-precision array The input observations.
fittedData double-precision array The calculated value of the best fit.
weight double-precision array The weight of the input observations.
numberOfElements integer The length of observations, fittedData, and weight.
degreeOfFreedom integer The degree of freedom, which is defined as numberOfElements minus the number of fitted coefficients. If degreeOfFreedom is negative or zero, the function sets degreeOfFreedom to numberOfElements - 2.
Output
Name Type Description
sse double-precision The summation of square error. The smaller the sse, the better the fit.
rSquare double-precision A normalized parameter to measure the goodness of fit. The closer to 1 the rSquare, the better the fit.
rmse double-precision The root mean square error. The smaller the rmse, the better the fit.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.