GoodnessOfFit
- Updated2023-02-21
- 2 minute(s) read
Advanced Analysis Library Only
AnalysisLibErrType GoodnessOfFit (double observations[], double fittedData[], double weight[], ssize_t numberOfElements, ssize_t 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 [] | The input observations. |
fittedData | double [] | The calculated value of the best fit. |
weight | double [] | The weight of the input observations. |
numberOfElements | ssize_t | The length of observations, fittedData, and weight. |
degreeOfFreedom | ssize_t | 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 | The summation of square error. The smaller the sse, the better the fit. |
rSquare | double | A normalized parameter to measure the goodness of fit. The closer to 1 the rSquare, the better the fit. |
RMSE | double | 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. |
Additional Information
Library: Advanced Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 8.0 and later