Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Mon Jul 7 22:58:58 MEST 2003
Dursun.Bulutoglu at afit.edu writes:
> I am having problems inverting matrices using the function
> For example R can not invert the following matrix
> [,1] [,2] [,3] [,4]
> [1,] 25 500 11250 275000
> [2,] 500 11250 275000 7106250
> [3,] 11250 275000 7106250 190625000
> [4,] 275000 7106250 190625000 5247656250
> [5,] 7106250 190625000 5247656250 147171875000
> Yields the following massage:
> Error in solve.default(t(xxmodel) %*% (xxmodel)) : singular matrix `a'
> in solve
> The above 5X5 matrix is invertible. It has non-zero eigenvalues. Could
> someone explain whether there is a problem in R's solve() function.
Please use the r-help list unless you are sure that you have found a
bug (and check up on the definition of a bug in the FAQ, and also
details required when reporting).
You seem to be running into a generic problem with matrix inverters,
namely that they are unhappy when the columns are on widely different
scales. Your diagonal elements vary by a factor of about 2e11. Since
detection of linear dependency has to operate with a small tolerance
to account for roundoff, this can become indistinguishable from a
nonsingular matrix with a large range of eigenvalues.
The typical workaround would to rescale the columns of xxmodel.
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-devel