I would like to calculate a covariance matrix of my data sample. How do I calculate the expected value for it, e.g.:
$$ E[(X_{2}-\mu_{2})(X_{1}-\mu_{1})] $$
My problem is, that I don't understand how to calculate the expected value since on wikipedia's definition I need a probility function for it (where shall it come from?). The mean is no problem but it's not the mean what is required, isn't it?
But I know how to calculate the covariance matrix via R
or Eigen
, thus I guess it is doable somehow.. but how??
Two parameters of my data sample:
X1={2.75083, 2.75095, 2.75074, 2.75106, 2.75082, 2.75096}
X2={376.499, 374.8, 373.288, 382.299, 377.092, 374.752}
edit: I read a bit more carefully and when all probabilities are equal then it's just an average indeed. Is that correct?