[R] Linear transformation of multivariate normal

Dmitry Pavlyuk dmitry.v.pavlyuk at gmail.com
Fri Jan 3 14:29:06 CET 2014


Hello, Colleges!

I'm having a problem with illustration of linear transformation of 
multivariate gaussian RV using R.
According to the theory, if X ~ N(0, I), then CX ~ N(0,CC').
But the code below doesn't illustrate this. Please could you help me to 
find a mistake

> require(tmvtnorm)
> C = matrix(c(2,0,1,1), 2,2)
> x = c(1,2)
> pmvnorm(lower=rep(-Inf,2),upper=x, sigma=diag(2))
[1] 0.822204
attr(,"error")
[1] 1e-15
attr(,"msg")
[1] "Normal Completion"
> pmvnorm(lower=rep(-Inf,2),upper=as.vector(C%*%x), sigma=C %*% t(C))
[1] 0.9452332
attr(,"error")
[1] 1e-15
attr(,"msg")
[1] "Normal Completion"

Dmitry



More information about the R-help mailing list