s-news
[Top] [All Lists]

Choleski upper triangular decomposition

To: s-news@lists.biostat.wustl.edu
Subject: Choleski upper triangular decomposition
From: Martyn Colins <martyncollins10@yahoo.com>
Date: Thu, 7 Dec 2006 06:07:19 -0800 (PST)
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=JdPvz1/Qo4WHjhVn8QxqL2O58x65K1FUJBnQHYbPMSs4CyG43HS1MS+9fcRHZYI4Mt0Sn/T9IiYadwkffYTBlZPrmgqQQFGrx6Q51xDInC4VsfQXwYl6PgnKxK3AIpf7wfwnsM/by7f1Thx4OgcsZ5FNO8hyS6vPy4RibddvqrE=;
 
I would like to obtain an upper triangular decomposition of a correlation matrix where all the diagonal terms are strictly above zero. The correlation matrix that I have is of full rank and has a non-zero determinant.
 
The matrix is defined as follows:
 
my.matrix <- matrix(0, 16, 16)
my.matrix[lower.tri(my.matrix)] <- c(
0.68, 0.79, 0.79, 0.83, 0.85, 0.86, 0.85, 0.85, 0.84, 0.82, 0.85, 0.82, 0.76, 0.81, 0.85,
0.82, 0.76, 0.66, 0.74, 0.65, 0.60, 0.51, 0.61, 0.70, 0.60, 0.69, 0.82, 0.63, 0.79,
0.74, 0.70, 0.75, 0.68, 0.64, 0.56, 0.66, 0.71, 0.62, 0.70, 0.77, 0.66, 0.73,
0.72, 0.78, 0.69, 0.65, 0.56, 0.69, 0.72, 0.62, 0.75, 0.75, 0.69, 0.75,
0.80, 0.73, 0.71, 0.62, 0.74, 0.73, 0.65, 0.75, 0.69, 0.72, 0.72,
0.79, 0.75, 0.72, 0.81, 0.79, 0.72, 0.83, 0.75, 0.75, 0.81,
0.70, 0.71, 0.74, 0.71, 0.70, 0.71, 0.67, 0.68, 0.75,
0.66, 0.71, 0.67, 0.66, 0.69, 0.64, 0.66, 0.72,
0.71, 0.62, 0.74, 0.61, 0.53, 0.57, 0.74,
0.72, 0.69, 0.75, 0.65, 0.70, 0.73,
0.65, 0.74, 0.70, 0.69, 0.74,
0.63, 0.60, 0.61, 0.73,
0.72, 0.73, 0.75,
0.67, 0.74,
0.69)
my.matrix <- my.matrix + t(my.matrix)
diag(my.matrix) <- 1
 
It has full rank:
qr(my.matrix)$rank
16
 
I get the following warning message:
decomp <- chol(my.matrix)
 
Warning messages:
Choleski decomposition not of full rank in: chol(my.matrix)
 
So I tried pivoting the choleski decomposition
decomp <- chol(my.matrix, pivot=T)
pivot <- attr(decomp, "pivot")
oo <- order(pivot)
t(decomp[, oo]) %*% decomp[, oo] # recover my.matrix
 
This does provide a decomposed matrix of full rank
qr(decomp)$rank
16
 
However, the diagonal elements are not all above zero:
 
decomp[row(decomp[,oo])==col(decomp[,oo])]
[1] 1.0000000 0.7332121 0.5763958 0.5394622 0.5369689 0.5339106 0.5294306 0.5174887 0.5167139 0.4963401 0.4905325 0.4557844
[13] 0.4095299 0.3783933 0.2495500 -0.6735201
 
(last element is not above zero).
 
Question is: how do I get an upper triangular decomposition of my original correlation matrix where all the diagonal terms are above zero?
 
Many thanks for any suggestions.
Regards
Martyn
 


Check out the all-new Yahoo! Mail beta - Fire up a more powerful email and get things done faster.
<Prev in Thread] Current Thread [Next in Thread>
  • Choleski upper triangular decomposition, Martyn Colins <=