Shantanu MULLICK
2012-Feb-21 00:18 UTC
[R] System is computationally singular error when using cholesky decompostion in MCMC
Hello Everyone I have a MCMC loop to calculate a time varying hierarchical Bayesian structure. This requires me to use around 5-6 matrix inversions in the loop. I use cholesky and chol2inv for the matrix decomposition. Because of the data I am working with I am required to invert a 167 by 167 matrix twice in one iteration. I need to run the iteration for 10000 times, but I get the error "System is computationally singular" after 5 iterations of the MCMC. Are there any "usual suspects", frequently occurring errors that I should pay attention to ? My code is 200 lines so I don't write it here. Naive question 1: Is it possible that the error is occurring for any other reason other than "matrix inversion" ? Naive question 2: Any suggestions on which debugging function (out of the many functions that R provides) would be the best to detect the error given my programming setup. I haven't used any of the debugging functions in R yet - in the past have been able to debug by going through the code. Thanks a lot ! Best Shantanu [[alternative HTML version deleted]]
R. Michael Weylandt
2012-Feb-21 02:33 UTC
[R] System is computationally singular error when using cholesky decompostion in MCMC
For question 2, my personal favorite is options(error=recover) which will let you take a look at all levels of the call stack as soon as an error is signaled. The debug package on CRAN is popular but I've never used it. Michael On Mon, Feb 20, 2012 at 7:18 PM, Shantanu MULLICK <b00295766 at essec.edu> wrote:> Hello Everyone > > I have a MCMC loop to calculate a time varying hierarchical Bayesian > structure. > > This requires me to use around 5-6 matrix inversions in the loop. > > I use cholesky and chol2inv for the matrix decomposition. > > Because of the data I am working with I am required to invert a 167 by 167 > matrix twice in one iteration. > > I need to run the iteration for 10000 times, but I get the error ?"System > is computationally singular" ?after 5 iterations of the MCMC. > > Are there any "usual suspects", frequently occurring errors that I should > pay attention to ? My code is 200 lines so I don't write it here. > > Naive question 1: Is it possible that the error is occurring for any other > reason other than "matrix inversion" ? > > Naive question 2: Any suggestions on which debugging function (out of the > many functions that R provides) ?would be the best to detect the error > given my programming setup. I haven't used any of the debugging functions > in R yet - in the past have been able to debug by going through the code. > > Thanks a lot ! > > Best > Shantanu > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > 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
- R utilizing 25% of CPU for Dual core i3 370M processor
- Simulating from "matrix variate normal distribution"
- Simulating from a Normal Inverted Wishart distribution
- Parameterization of Inverse Wishart distribution available in MCMCpack and bayesm libraries
- Cholesky Decomposition