Stephan Lindner
2009-Aug-15 23:15 UTC
[R] System is computationally singular and scale of covariates
Dear all, I'm running a self-written numerical optimization routine (hazard model) which includes computing the inverse of the outer product of the score. I have been getting the above error message ("System is computationally singular"), and after some tweaking, I realized that these variables have some high numbers and the problem could be circumvented by scaling them down (i.e. dividing them by 100 or taking log). Since this is obviously not the best procedure, and since I have to estimate more complex models down the rode, I would like to understand better the reason which causes this problem. It is not a multicollinearity issue (I get the error even when using one single variable), and I think my code is clean (better be paranoid though). My sense is that the outer product just becomes large, and these are hard to invert. Maybe there are restrictions concering R in the size of the numbers? If that is the case, I think I would fare better scaling down the outer product rather than the variable itself, but I first wanted to ask the community to get and understanding of what could be the problem. Thanks a lot, Stephan Lindner -- ----------------------- Stephan Lindner University of Michigan
Moshe Olshansky
2009-Aug-17 04:15 UTC
[R] System is computationally singular and scale of covariates
Hi, What do you mean by outer product? If you have two vectors, say x and y, of lenght n and you define matrix A by A(i,j) = x(i)*y(j) then your matrix has rank one and it is VERY singular (in exact arithmetics). Is this is what you mean by outer product? --- On Sun, 16/8/09, Stephan Lindner <lindners at umich.edu> wrote:> From: Stephan Lindner <lindners at umich.edu> > Subject: [R] System is computationally singular and scale of covariates > To: r-help at stat.math.ethz.ch > Received: Sunday, 16 August, 2009, 9:15 AM > Dear all, > > > I'm running a self-written numerical optimization routine > (hazard > model) which includes computing the inverse of the outer > product of > the score. I have been getting the above error message > ("System is > computationally singular"), and after some tweaking, I > realized that > these variables have some high numbers and the problem > could be > circumvented by scaling them down (i.e. dividing them by > 100 or taking > log). > > Since this is obviously not the best procedure, and since I > have to > estimate more complex models down the rode, I would like to > understand > better the reason which causes this problem. It is not a > multicollinearity issue (I get the error even when using > one single > variable), and I think my code is clean (better be > paranoid > though). My sense is that the outer product just becomes > large, and > these are hard to invert. Maybe there are restrictions > concering R in > the size of the numbers? If that is the case, I think I > would fare > better scaling down the outer product rather than the > variable itself, > but I first wanted to ask the community to get and > understanding of > what could be the problem. > > > Thanks a lot, > > > > ??? Stephan Lindner > > > > > > > > > -- > ----------------------- > Stephan Lindner > University of Michigan > > ______________________________________________ > R-help at r-project.org > mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. >
Apparently Analagous Threads
- Create variables with common values for each group
- Using apply to generate matrix from rows?
- Using by() and stacking back sub-data frames to one data frame
- tapply and any
- Importing csv file with character values into sqlite3 and subsequent problem in R / RSQLite