# Estimate covariance matrix using R without knowing the joint distribution

n <- 10000
X <- rnorm(n, mean = 3, sd = 3)
Y <- rexp(n, rate = 2)
Z <- rnorm(n, mean = -2, sd = 0.5)

cov(X, Y)
cov(X, Z)
cov(Y, Z)


Suppose I know the marginal distributions of the random variables $$X \sim N(3, 9)$$, $$Y \sim Exp(2)$$, and $$Z \sim N(-2, 0.025)$$. However, I do not have any information on the joint distribution of $$(X, Y, Z)$$ and I do not know whether these r.v.s are independent or not.

I'm interested in estimating the covariance matrix $$Cov\begin{bmatrix}X\\ Y \\ Z\end{bmatrix}$$. Is it appropriate to do what I did above: generate observations from each marginal distribution and simply use the sample covariance as an estimate? i.e., cov(X, Y), cov(X, Z), cov(Y, Z) in R?

• @stans thanks. would you like to add your comment as an answer? Commented Jan 21, 2021 at 16:01
• Sure. Have done it. Commented Jan 21, 2021 at 16:14

No. What you did above is simulated $$(X,Y,Z)$$ where $$X$$, $$Y$$ and $$Z$$ are independent. The sample covariances will simply converge to 0 as $$n$$ converges to infinity. To simulate any random variables jointly, you have to have an idea how they are related