On Thu, May 05, 2011 at 02:31:59PM -0400, Arthur Charpentier wrote:
I do have some trouble with matrices. I want to build up a covariance matrix
with a hierarchical structure). For instance, in dimension n=10, I have two
subgroups (called REGION).
NR=2; n=10
CORRELATION=matrix(c(0.4,-0.25,
thanks for the tip
actually, I know that the covariance matrix has rank 2, but it should still
be definite positive (not strictly positive, but positive)
my problem is that Cholesky needs a positive matrix...
my concern is that I have
min(eigen(SIGMA)$values)
[1] -2.109071e-17
while theoretically
sorry, my mistake...
since I build up a correlation matrix, I forgot the fact that the diagonal
should be one
NR=2
CORRELATION=matrix(c(0.4,-0.25,
-0.25,0.3),NR,NR)
REGION=sample(1:NR,size=n,replace=TRUE)
SIGMA=CORRELATION[REGION,REGION]
diag(SIGMA)=1
I do have some trouble with matrices. I want to build up a covariance matrix
with a hierarchical structure). For instance, in dimension n=10, I have two
subgroups (called REGION).
NR=2; n=10
CORRELATION=matrix(c(0.4,-0.25,
-0.25,0.3),NR,NR)