1

I am trying to use chol() to find the Cholesky decomposition of the correlation matrix below. Is there a maximum size I can use that function on? I am asking because I get the following:

d <-chol(corrMat)
Error in chol.default(corrMat) : 
  the leading minor of order 61 is not positive definite

but, I can decompose it for less than 60 elements without a problem (even when it contains the 61st element of the original):

> d  <-chol(corrMat[10:69, 10:69])
> d  <-chol(corrMat[10:70, 10:70])
Error in chol.default(corrMat[10:70, 10:70]) : 
  the leading minor of order 61 is not positive definite

Here is the matrix:

https://drive.google.com/open?id=0B0F1yWDNKi2vNkJHMDVHLWh4WjA

Zheyuan Li
  • 71,365
  • 17
  • 180
  • 248
user3390169
  • 1,015
  • 1
  • 11
  • 34
  • @zheyuan li That works in that it gives me an answer but I do not understand the output. I intend to use this for Monte Carlo simulation and, from what I am reading about pivot, the output is in a different order from the original matrix. Is it still useable? – user3390169 Mar 20 '17 at 20:48

1 Answers1

2

The problem is not size, but numerical rank!

d <- chol(corrMat, pivot = TRUE)

dim(corrMat)
#[1] 72 72

attr(d, "rank")
#[1] 62

corrMat is not positive-definite. Ordinary Cholesky factorization will fail, but pivoted version works.

The correct Cholesky factor here can be obtained (see Correct use of pivot in Cholesky decomposition of positive semi-definite matrix)

r <- attr(d, "rank")
reverse_piv <- order(attr(d, "pivot"))
d[-(1:r), -(1:r)] <- 0
R <- d[, reverse_piv]

Whether this is acceptable depends on your context. It might need corresponding adjustment to your other code.

Pivoted Cholesky factorization can do many things that sound impossible for a deficient, non-invertible covariance matrix, like

Zheyuan Li
  • 71,365
  • 17
  • 180
  • 248
  • @zheyuan li I like your answer but I do not yet know if it is the right one. I do not understand from reading the documentation what the pivot option is doing. I am using d to generate Monte Carlo simulations for a portfolio of assets. So, I generate a bunch of random normal, adjust them by their corresponding vols and then pass the result through d. If I do this with your matrix R, am I losing any information about my portfolio (will the resulting returns have the correct correlations)? How does the reordering of the pivot allow for the Cholesky decomposition to work? – user3390169 Mar 20 '17 at 23:18