[R] how to get condition number from lm output
Uwe Ligges
ligges at statistik.uni-dortmund.de
Fri Oct 3 12:23:48 CEST 2003
Uwe Ligges wrote:
>
> Mai Zhou wrote:
> >
> > Dear r-help,
> >
> > I ran
> >
> > output <- lm(formu, data=mydata)
> >
> > I want to look at the condition number (to see if the matrix is near singular). How?
>
> kappa(output)
>
>
> > Also, I use the function stepAIC from MASS to select models, how can I see the condition numbers in each step?
>
> See the argument "keep" described in ?stepAIC
> So you can use something like
>
> stepAIC(. . . . ., keep = function(fit, AIC) kappa(fit))
Let me add: To print it also to the console, use:
stepAIC(. . . . ., keep =
function(x,y) {k <- kappa(x); cat("kappa =", k, "\n"); k})
Uwe Ligges
>
> > While I am at it. I find a minor bug:
> > R 1.7.1 on window XP, when you copy and paste by click
> > one button, then the input stopped, until you click the
> > "copy and paste" button again and click OK.
>
> ALready fixed for R-1.8.0 (beta).
>
> Uwe Ligges
>
> > Thanks in advance.
> >
> > Mai Zhou
> > mai at ms.uky.edu
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list