##
lower=c(-1,-1,-1)
upper=c(1,1,1)
mean=c(0,0,0)
sigma=matrix(c(1, 0.8, 0.2,
0.8, 1, 0.1,
0.2, 0.1, 1), 3, 3)
X = rtmvnorm(n=1000, mean=c(0,0,0), sigma=sigma, lower=lower, upper=upper)
x = seq(-1, 1, by=0.001)
Fx = ptmvnorm.marginal(xn=x, n=1, mean=c(0,0,0), sigma=sigma, lower=lower, upper=upper)
plot(ecdf(X[,1]))
lines(x, Fx, type="l", col="blue")
Run the code above in your browser using DataLab