[R] Cp -Inf

Thomas Lumley tlumley at uw.edu
Tue Nov 22 20:10:50 CET 2011


On Wed, Nov 23, 2011 at 3:55 AM, Stephen Sefick <sas0025 at auburn.edu> wrote:
> Hello All:
>
> I am using the leaps package on scale and centered data for an exhaustive
> search.  There are Cp values of -Inf being returned for all models.  I was
> going to look at the source before contacting the list, but it has been a
> while since I have looked under the hood.  There are .rdb and .rdx files
> where I expected the source files to be.  I am sure that I have over looked
> something.  I can provide data and code if it is needed.

The best place to find the source is the source code package, also on
CRAN (but you can also get it from inside R)

The -Inf occurs when there are linear dependencies in your predictors,
so that the 'full model' residual sum of squares is zero. Calculating
Cp involves dividing the residual mean square for each model by the
residual mean square for the full model, and this obviously will break
down.  The fact that it returns -Inf rather than +Inf is probably a
bug, and there should be an explanation in the documentation of why
you can't get Mallows' Cp for some data sets.

You might think it would be possible to divide by the residual mean
square for the best model rather than the full model, but 'best model'
isn't well defined -- and the reason that the 'leaps' package exists
is to provide large sets of best models, not a single one.

  -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland



More information about the R-help mailing list