[R] Lack of Fit test

Alan T. Arnholt arnholt at math.appstate.edu
Wed Feb 23 15:40:21 CET 2000

```I guess my question was not adequately stated when I sent it to the list.  I was
inquiring to see if anyone had written code to perform a lack of fit test in the
special case when you have replicate predictors.  If your predictors contain
replicates (repeated x values with one predictor or repeated combinations of x
values with multiple predictors), you can easily calculate a pure error test for
lack of fit. The error term will be partitioned into pure error (error within replicates)
, and a lack of fit error and the F-test can be used to test if you have chosen an
adequate regression model.  See Neter, Kutener, Nachtsheim, and Wasserman fourth edition
page 115, or Draper and Smith.  Bill Venables wrote "...It makes it
impossible to write code to do it automatically, but if you know
what you are doing, the procedure is simple with the software you
have.  As with so many things in statistics, it is not a matter
of good software so much as of having a good understanding of the
problem in hand."  I guess I am not sure what "if you know what you are doing the
procedure is simple..." means since I clearly know what I am doing in reference to
the statistical procedure.  Where I need help is not with the statistics, but rather
with automating the procedure in R.

On Wed, 23 Feb 2000 12:48:49 +1000 Bill Venables
<William.Venables at cmis.CSIRO.AU> wrote:

>
> > Does anyone know of a "Lack of Fit" program for regression or
> > have any thoughts on how one might work with "lm" to create
> > such code?  Many thanks in advance.
>
> There is no canonical way of doing this.  This is primarily why
> people use regression diagnostics.
>
> Most standard tests for lack of fit, such as chi-squared tests,
> amount to testing the current model within some global model that
> contains all realistic models as special cases.  With regression
> models that information has to be used to estimate the variance,
> and indeed if you knew sigma^2 beforehand you could use the RSS
> for a chi-squared test of lack of fit, but mostly you do not know
> sigma^2 beforehand.
>
> The same idea can be used to produce a special purpose test for
> lack of fit, even if it must lack the global aspect of standard
> chi-squared test.  What you do is dream up a larger model that
> contains the model you are considering as a special case but has
> enough flexibility to cater for any of the kinds of lack of fit
> you think might be worth checking for.  The larger model still
> has to have enough residual degrees of freedom, though, to allow
> you to estimate sigma^2 in a fairly stable manner (you might even
> consider doing it robustly).  Then test the chosen model within
> the outer model in the standard way.
>
> Of course this demands that you have enough knowledge of the
> situation to choose the outer model satisfactorily.  It makes it
> impossible to write code to do it automatically, but if you know

> what you are doing the procedure is simple with the software you
> have.  As with so many things in statistics, it is not a matter
> of good software so much as of having a good understanding of the
> problem in hand.
>
> Bill Venables.
> --
> Bill Venables,      Statistician,     CMIS Environmetrics Project
> CSIRO Marine Labs, PO Box 120, Cleveland, Qld,  AUSTRALIA.   4163
> Tel: +61 7 3826 7251           Email: Bill.Venables at cmis.csiro.au
> Fax: +61 7 3826 7304      http://www.cmis.csiro.au/bill.venables/
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

___________________________________
Alan T. Arnholt
Associate Professor
Dept. of Mathematical Sciences
Appalachian State University
Boone, NC  28608
http://www.mathsci.appstate.edu/~arnholt/
Office phone: (828) 262 - 2863
Office fax  : (828) 265 - 8617

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```