# how to calculate the covariance of sample central moments

$\bar{x}= \sum_{i=1} ^{n} \frac{1}{n}x_{i}$

$m_1=\sum _{i=1} ^{n} \frac{1}{n} (x_{i}-\bar{x})$

$m_2=\sum _{i=1} ^{n} \frac{1}{n} (x_{i}-\bar{x})^2$

$m_3=\sum _{i=1} ^{n} \frac{1}{n}(x_{i}-\bar{x})^3$

how to get the explicit solution of the co-variance matrix of $\bar{x},m_1,m_2,m_3$, thanks !

Simulation for code(R code)

n=10^5 simu.num=10^4 for(simu in 1:simu.num) { w1=rbeta(n,shape1=2,shape2=5) v1=w1-mean(w1) c1[simu]=mean(w1) c2[simu]=mean(v1^2) c3[simu]=mean(v1^3)}

W1=rbeta(10^6,shape1=2,shape2=5)

theta6=mean((W1-mean(W1))^6) theta3=mean((W1-mean(W1))^3) theta2=mean((W1-mean(W1))^2) theta4=mean((W1-mean(W1))^4) theta5=mean((W1-mean(W1))^5) theta5=mean((W1-mean(W1))^6)

cov(c2,c3)*n [1] 0.0002295468

theta5-4*theta2*theta3 [1] -3.909604e-06

Here \theta_{j} is the jth central moments

• This site is for the computer algebra software Mathematica. This question does not relate to that, and would be more appropriate for Statistics.SE. Commented Apr 28, 2015 at 3:12
• It sure does relate to Mma ... in fact, calculating it without mma would be a nightmare. Commented Apr 28, 2015 at 3:38
• @wolfies have to agree with you there. It would be "interesting" to calculate those. Commented Apr 28, 2015 at 12:35
• In Mathematica, the mean is just Mean[list] and the central moments are just CentralMoment[list, r] Commented Apr 28, 2015 at 12:56
• @BobHanlon The user's input is not a data set, but rather a symbolic statistic such as the sample variance which is itself a random variable. CentralMoment[list] does something very different. Commented Apr 28, 2015 at 13:37

This is a problem known as finding moments of moments. In this case, we seek the covariance (i.e. the $\mu_{1,1}$ central moment) of various sample moments. The modus operandi for solving such problems is to work with power sum notation $s_r$, namely:

$$s_r = \sum_{i=1}^n X_i^r$$

In this case, you are interested in the sample mean $= \frac{s_1}{n}$, and the $2^{nd}$, $3^{rd}$ and $4^{th}$ sample central moments which can be expressed in terms of power sums using the functions:

where I am using the SampleCentralToPowerSum functions from the mathStatica package for Mathematica. That completes the set-up.

Solution

The covariance operator is just the $\mu_{1,1}$ central moment ... so:

• $Cov(m_2,m_3)$ is given by:

where $\mu_r$ denotes the $r^{th}$ central moment of $X$ i.e. $\mu_r = E[(X-\mu)^r]$ and CentralMomentToCentral is another function from the mathStatica package for Mathematica.

• Similarly, $Cov(\bar{x}, m_4)$ is given by:

• $Cov(\bar{x}, m_3)$ is:

etc ... One can easily and immediately compute all the possible covariance relations in this manner. Doing so without a computer algebra system is extremely difficult. The solutions can be quite long (to visually present), so it is probably better to do them one by one, rather than try to display them all in one big variance-covariance matrix.

P.S. Just as a note, by definition $m_1 = 0$.

• hi, great thanks!! I do a little simulation about the cov(m2,m3) part, the answer is not consistent with the formula given above, and what's the covariance of cov(s1/n, m3)?
– user28085
Commented Apr 28, 2015 at 13:44
• I think you will need to show us your simulation to comment further on that component. I have added $Cov(\frac{s_1}{n}, m_3)$ to the above. Commented Apr 28, 2015 at 14:08
• Grear thanks! @wolfies. I will definitely learn howto use this amazing Mathematica, since it cost me several weeks calculate these things, while did not get all the right answers. I do not know how to paste code in the comment, since it will show in the same row. I put it in my question above. By the way, I could not see the part cov(s1/n,m3) yet...
– user28085
Commented Apr 28, 2015 at 14:26
• You may have to refresh the browser window to see the update ... Commented Apr 28, 2015 at 14:26
• It's right, I found where I am wrong. Great thanks for your precious help.： ）
– user28085
Commented Apr 28, 2015 at 17:04