[R] Generate positive definite matrix with constraints

Gabor Grothendieck ggrothendieck at gmail.com
Sun May 19 23:04:13 CEST 2013


On Sun, May 19, 2013 at 4:57 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> On Sun, May 19, 2013 at 10:33 AM, mary <mary.dama at libero.it> wrote:
>>
>> Sorry in the previuos message I've inverted:  I would like generate ...
>> "same eigenvectors and different eigenvalues"
>
> Try this:
>
> m0 <- 5 + matrix(c(.05, -.05, -.05, .05), 2)
> m0.values <- eigen(m0)$values
> with(eigen(matrix(rnorm(4), 2)), vectors %*% diag(m0.values) %*% solve(vectors))

I think I reversed it too.  If that's not it try this:

m0.vectors <- eigen(m0)$vectors
with(eigen(matrix(rnorm(4), 2)), m0.vectors %*% diag(values) %*%
solve(m0.vectors.0))


--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list