Re: [Rd] matrix not positive definite (while it should be)

2011-05-06 Thread Petr Savicky
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,

Re: [Rd] matrix not positive definite (while it should be)

2011-05-06 Thread Arthur Charpentier
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

Re: [Rd] matrix not positive definite (while it should be)

2011-05-06 Thread Arthur Charpentier
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

[Rd] matrix not positive definite (while it should be)

2011-05-05 Thread Arthur Charpentier
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)