lofrtest

Lack-of-fit test for regression model with independent replicate values.
2.1K Downloads
Updated 22 Jun 2005

View License

This m-file provides a statistical test that gives information on the form of the model under consideration. A significant lack-of-fit suggest that there may be some systematic variation unaccounted for in the hypothesized model (chosen model does not well describe the data). It arises when there are exact replicate values of the independent variable in the model that provide an estimate of pure error. Pure error is in essence the amount of error that cannot be accounted for by any model. Then allows a test on whether there is error present aside from pure error. For the construction of the lack-of-fit test we need to examine three common types of linear models:
- single mean (one parameter)
- slope and intercept or common regression model (two parameters)
- separate means for each x-value or one-way ANOVA (many parameters).

So, the pure error is the error of the separate means on ANOVA and the total error in the residual resulting in the regression analysis. So, the lack-of-fit results to be the difference between this two sources of error,

SS(LOF) = SSR(Model) - SSE(ANOVA).

It needs to input D-matrix data (=[X Y]) (last column must be the Y-dependent variable). (X-independent variable entry can be for a simple [X], multiple [X1,X2,X3,...Xp] or polynomial [X,X^2,X^3,...,X^p] regression model.), and alpha-significance level (default = 0.05).

It outputs a complete summary (table) of analysis of variance partitioning sources of variation for testing lack-of-fit.

Cite As

Antonio Trujillo-Ortiz (2026). lofrtest (https://uk.mathworks.com/matlabcentral/fileexchange/7074-lofrtest), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R11
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.0.0

Text was improved.