Introduction to different moments of distributions (Planned)

We will get into how to get different moments of different distributions and possible skewness and kurtosis of different distributions. We will also discuss the relationship between different moments and the moment generating function.

Some authorUpdated 7 min read

Understanding Moments

We already have the following for the moment generating function.

If XiX_i has moment generating function fXi(z;i)f_{X_i}(z;i), then we will have

fαXi(z;i)=EXi[exp⁡(αXiz)]=EXi[exp⁡(Xi(αz))]=fXi(αz;i)f_{\alpha X_i}(z;i) = \mathbb{E}_{X_i}[\exp(\alpha X_iz)] = \mathbb{E}_{X_i}[\exp(X_i (\alpha z))] = f_{X_i}(\alpha z; i)

and

fα+Xi(z;i)=EXi[exp⁡((α+Xi)z)]=exp⁡(αz)EXi[exp⁡(Xiz)]=exp⁡(αz)fXi(z).f_{\alpha + X_i}(z;i) = \mathbb{E}_{X_i}[\exp((\alpha+X_i)z)] = \exp(\alpha z)\mathbb{E}_{X_i}[\exp(X_iz)] = \exp(\alpha z) f_{X_i}(z).

and

f∑iXi(z;i)=E∑iXi[exp⁡(z∑iXi)]=∏iEXi[exp⁡(Xiz)]=∏ifXi(z).f_{\sum_i X_i}(z;i) = \mathbb{E}_{\sum_i X_i} [\exp(z\sum_i X_i)] = \prod_i \mathbb{E}_{X_i}[\exp(X_iz)] = \prod_i f_{X_i}(z).

Now, let's move beyond these constant operations or adding and consider some more interesting operations.

Compounding pgf:

If XX has pgf PX(z)P_X(z) and YY has pgf PY(z)P_Y(z), then their compounding distribution denote as Z=X×YZ = X \times Y will have the following:

PZ(z)=PX(PY(z)).P_Z(z) = P_X(P_Y(z)).

We have already seen the following properties:

MX(z)=PX(exp⁡(z)).M_X(z) = P_X(\exp(z)).

So

MZ(z)=PZ(exp⁡(z))=PX(PY(exp⁡(z)))=PX(MY(z)).M_Z(z) = P_{Z}(\exp(z)) = P_X(P_Y(\exp(z)))= P_X(M_Y(z)).

Now, let's consider some of the moments from a distribution.

We know that a distribution can have their first moment calculated by taking their moment generating function's first derivative and setting the variable to 1. And the second moment is just second derivative evaluated at 1.

We will denote a distribution's i-th moment as ZiZ_i from now on for any distribution ZZ.

Then the skewness γ1\gamma_1 can be expressed as

γ1[Z]:=Z3(Z2−Z2)3/2\gamma_1[Z] :=\frac{Z_3}{(Z_2 -Z^2)^{3/2}}

and kurtosis Kurt\text{Kurt} can be expressed as

Kurt[Z]=Z4(Z2−Z2)2.\text{Kurt}[Z] = \frac{Z_4}{(Z_2 - Z^2)^2}.

There's also an important concept of cumulant. Cumulants are important statistical concepts because the first, second, third cumulants provide an alternative way of computing the mean, variance and third central moments. However, we will have trouble with higher as they do not coincide with the central moments.

A definition of cumulant generating function is the following:

KX(z)=log⁡(MX(z)).K_X(z) = \log (M_X(z)).

And we can use Maclaurin series to expand the summation and get the coefficients.

Now, let's consider several well-known distributions' moment generating function and skewness and kurtosis.

Normal Distribution\textbf{Normal Distribution}

First, let's consider normal distribution:

fZ(z)=(2πb2)−1/2exp⁡(−12(z−a)2/b2)f_Z(z) = (2\pi b^2)^{-1/2} \exp\left(-\frac{1}{2}(z-a)^2/b^2\right)

Then it will have the following mgf:

EZ[exp⁡(Zt)]=∫−∞∞exp⁡(zt)(2πb2)−1/2exp⁡(−12(z−a)2/b2) dz=(2πb2)−1/2∫−∞∞exp⁡(zt−12(z−a)2/b2) dz\mathbb{E}_Z[\exp(Zt)] = \int_{-\infty}^{\infty} \exp(zt)(2\pi b^2)^{-1/2} \exp\left(-\frac{1}{2}(z-a)^2/b^2\right) \, dz\\=(2\pi b^2)^{-1/2}\int_{-\infty}^{\infty} \exp\left(zt -\frac{1}{2}(z-a)^2/b^2 \right)\, dz

If we are attentive on zt−12(z−a)2/b2zt -\frac{1}{2}(z-a)^2/b^2, we will have

tz−12z2+a2−2azb2=−12b2(−2b2tz+z2+a2−2az)=−12b2(z2−(2a+2b2t)z+a2)tz - \frac{1}{2}\frac{z^2 +a^2 -2az}{b^2} = -\frac{1}{2b^2} \left(-2b^2 tz+z^2 +a^2 -2az\right)= -\frac{1}{2b^2}(z^2 -(2a+2b^2t)z+a^2)

Notice that (a+b2t)2=a2+2ab2t+b4t2(a+b^2t)^2 = a^2 + 2ab^2 t +b^4 t^2 and so

tz−12z2+a2−2azb2=−12b2(z2−(2a+2b2t)z+(a+2b2t)2−2ab2t−b4t2)=−12b2(z−a−2b2t)2+at+12b2t2tz - \frac{1}{2}\frac{z^2 +a^2 -2az}{b^2} = -\frac{1}{2b^2}(z^2 - (2a+2b^2t)z+(a+2b^2t)^2 -2ab^2t -b^4 t^2) = -\frac{1}{2b^2}(z-a-2b^2t)^2 +at +\frac{1}{2}b^2 t^2

And so

EZ[exp⁡(Zt)]=(2πb2)−1/2∫−∞∞exp⁡(−12b2(z−a−2b2t)2+at+12b2t2) dz=exp⁡(at+12b2t2)(2πb2)−1/2∫−∞∞exp⁡(−12b2z2) dz=exp⁡(at+12b2t2)π−1/2∫−∞∞exp⁡(−z2) dz\mathbb{E}_Z[\exp(Zt)] =(2\pi b^2)^{-1/2}\int_{-\infty}^{\infty} \exp\left(-\frac{1}{2b^2}(z-a-2b^2t)^2 +at +\frac{1}{2}b^2 t^2 \right)\, dz\\=\exp\left( at +\frac{1}{2}b^2 t^2 \right)(2\pi b^2)^{-1/2}\int_{-\infty}^{\infty} \exp\left(-\frac{1}{2b^2}z^2\right) \, dz \\= \exp\left( at +\frac{1}{2}b^2 t^2 \right)\pi^{-1/2} \int_{-\infty}^{\infty} \exp(-z^2)\, dz

We know that ∫−∞∞exp⁡(−z2) dz=π\int_{-\infty}^{\infty}\exp(-z^2)\,dz = \sqrt \pi so we will have the moment generating function for normal distribution to be exp⁡(at+12b2t2)\exp\left( at +\frac{1}{2}b^2 t^2 \right).

Now, let's consider normal distribution's cousin chi-squared distribution (which is one transformation of normal distribution).

χ2 distribution\chi^2\textbf{ distribution}

We know the definition of chi-squared distribution follows the squared of a normal distribution e.g. if XX is a χ2\chi^2 distribution, then we will have

X=Z2.X =Z^2.

where ZZ is a standard normal distribution.

Then its pdf will have the following form:

(2πz)−1/2exp⁡(−z2)(2\pi z)^{-1/2}\exp\left(-\frac{z}{2}\right)

Generalized moments.

Suppose we have a function S(z;θ)S(z;\theta) that is differential or smooth, the function can be a moment generating function or any other function of any kind with hyperparameter θ\theta, then we can define the expected value of the function as ∂zS(z;θ)∣z=0\partial_z S(z;\theta) \mid_{z = 0} and the second moment of the function as ∂z2S(z;θ)∣z=0\partial^2_z S(z;\theta) \mid_{z=0} and the nn-th moment as ∂znS(z;θ)\partial_z^n S(z;\theta).

Example. Suppose we have the following function with hyperparameters m,km, k defined as

I(m,k)=[1−β(exp⁡(z)−1)]mexp⁡(kz)I(m,k) = \left[1-\beta(\exp(z)-1)\right]^m \exp(kz)

Then we will have

∂zI(m,k)=−βm[1−β(exp⁡(z)−1)]m−1exp⁡((k+1)z)+k[1−β(exp⁡(z)−1)]mexp⁡(kz)\partial_z I(m,k) = -\beta m\left[1-\beta(\exp(z)-1)\right]^{m-1} \exp((k+1)z) + k\left[1-\beta(\exp(z)-1)\right]^m \exp(kz)

and so we will have

∂zI(m,k)=−βmI(m−1,k+1)+kI(m,k)\partial_z I(m,k) = -\beta m I(m-1, k+1) + k I(m,k)

We can even get a ordinary differential equation from this and we even know the solution already.

∂zf−kf=−βmI(m−1,k+1)\partial_z f - k f = -\beta m I(m-1, k+1)

whose solution is [1−β(exp⁡(z)−1)]mexp⁡(kz).[1-\beta (\exp(z)-1)]^m \exp(kz).

Now let's compute the expected value M1M_1 of the function I(−r,0)I(-r,0), we will get

M1=∂zI(−r,0)∣z=0=βrI(−r−1,1)∣z=0=βrM_1=\partial_z I(-r,0) \mid_{z =0} = \beta rI(-r-1, 1) \mid_{z =0} = \beta r

and its second moment M2M_2 will be

M2=∂z2I(−r,0)∣z=0=βr∂zI(−r−1,1)∣z=0=βr(β(r+1)+1)=βr(βr+β+1)M_2=\partial^2_z I(-r,0) \mid_{z=0}= \beta r\partial_z I(-r-1, 1)\mid_{z=0} = \beta r (\beta(r+1)+1) = \beta r(\beta r + \beta + 1)

And so the variance in the ordinary sense will be

βr(βr+β+1)−β2r2=βr(β+1)\beta r(\beta r + \beta+1)-\beta^2 r^2 =\beta r(\beta+1)

Now if we compute the third moment M3M_3, we will get the following:

M3=∂z3I(−r,0)∣z=0=βr∂z2I(−r−1,1)∣z=0=βr∂z(β(r+1)I(−r−2,2)+I(−r−1,1))∣z=0=βr[β(r+1)∂zI(−r−2,2)+∂zI(−r−1,1))∣z=0=βr[β(r+1)(β(r+2)+2)+βr+β+1]=βr[β2(r+1)(r+2)+3β(r+1)+1]=β3r(r+1)(r+2)+3β2r(r+1)+3βr−2βr=β3r(r+1)(r+2)+3M2−2M1M_3 = \partial^3_z I(-r,0) \mid_{z=0} = \beta r\partial^2_z I(-r-1, 1)\mid_{z=0} \\= \beta r \partial_z (\beta (r+1)I(-r-2 , 2)+I(-r-1,1))\mid_{z=0} \\ =\beta r [\beta (r+1)\partial_zI(-r-2 , 2)+\partial_zI(-r-1,1)) \mid_{z=0} \\=\beta r[\beta (r+1) (\beta (r+2)+2) +\beta r + \beta + 1]\\ = \beta r [\beta^2 (r+1) (r+2) + 3 \beta (r+1) +1 ] \\= \beta^3 r(r+1)(r+2) +3 \beta^2 r(r+1)+3\beta r -2\beta r \\= \beta^3 r(r+1)(r+2) +3M_2 -2M_1

Notice (M2−M1)2=(βrβ(r+1))2=β4r2(r+1)2(M_2 - M_1)^2 = (\beta r \beta (r+1))^2 = \beta^4 r^2 (r+1)^2 so β3r(r+1)2=(M2−M1)2M1\beta^3 r (r+1)^2 = \frac{(M_2-M_1)^2}{M_1}

and so we will have

M3=(M2−M1)2M1r+2r+1+3M2−2M1.M_3 = \frac{(M_2-M_1)^2}{M_1} \frac{r+2}{r+1} +3 M_2 - 2M_1.

A more concrete case of the above can be attributed to the ETNB, notice that ETNB's mgf has the following form:

MX(z)=1(1+β)r−1((1+β1−β(exp⁡(z)−1))r−1)=C1((1+β1−β(exp⁡(z)−1))r)−C2=C3(1−β(exp⁡(z)−1))−r−C2=C3I(−r,0)−C2M_X(z)=\frac{1}{(1+\beta)^r-1}\left(\left(\frac{1+\beta}{1-\beta(\exp(z)-1)}\right)^r-1\right) \\=C_1\left(\left(\frac{1+\beta}{1-\beta(\exp(z)-1)}\right)^r\right) -C_2 \\= C_3 (1 -\beta(\exp(z)-1))^{-r}-C_2\\= C_3 I(-r,0)-C_2

So it's essentially the same as I(−r,0)I(-r,0) except with constant scaling and extra constant term. Since we will see shortly that the constant terms won't affect us with our computation.

Theorem. 1\textbf{Theorem. } 1 If MkM_k is kk-th moment of a function gg, then αMk\alpha M_k is the kk-th moment of αg+β\alpha g + \beta where α,β\alpha, \beta are constants.

Proof.\textbf{Proof.}

We observe that ∂tk(αg+β)=α∂tkg=αMk\partial_t^k (\alpha g+\beta) = \alpha \partial_t^k g = \alpha M_k

We can use theorem 11. to show the above relation

M3=(M2−M1)2M1r+2r+1+3M2−2M1.M_3 = \frac{(M_2-M_1)^2}{M_1} \frac{r+2}{r+1} +3 M_2 - 2M_1.

still holds for the case of ETNB.

More specifically, consider N3=C3M3N_3 = C_3 M_3 and N2=C3M2N_2 = C_3 M_2 and N1=C3M1N_1 = C_3 M_1, then we will have M3=αN3M_3 = \alpha N_3, M2=αN2M_2 = \alpha N_2, M1=αN1M_1 = \alpha N_1 for α=1C3\alpha = \frac{1}{C_3}.

αN3=α2(N2−N1)2αN1r+2r+1+3αN2−2αN1  ⟹  N3=(N2−N1)2N1r+2r+1+3N2−2N1\alpha N_3 = \frac{\alpha^2(N_2-N_1)^2}{\alpha N_1} \frac{r+2}{r+1} +3 \alpha N_2 - 2 \alpha N_1 \implies N_3 = \frac{(N_2-N_1)^2}{ N_1} \frac{r+2}{r+1} +3 N_2 - 2 N_1

Example 2.\textbf{Example 2.} consider I(n)=(a+2bt)nexp⁡(at+bt2)I(n) = (a+2bt)^n \exp(at +bt^2),

then ∂tI(n)=n(2b)(a+2bt)n−1exp⁡(at+bt2)+(a+2bt)n+1exp⁡(at+bt2)=2bnI(n−1)+I(n+1)\partial_t I(n) = n (2b) (a+2bt)^{n-1} \exp(at +bt^2) + (a+2bt)^{n+1} \exp(at+bt^2) = 2bn I(n-1) + I(n+1)

so M1=∂tI(0)∣t=0=I(1)∣t=0=aM_1 = \partial_t I(0) \mid_{t=0} = I(1) \mid_{t=0} = a

M2=∂t2I(0)∣t=0=∂tI(1)∣t=0=(2bI(0)+I(2))=2b+a2=σ2+a2M_2 =\partial^2_t I(0) \mid_{t=0}= \partial_t I(1) \mid_{t=0} = \left(2b I(0) + I(2)\right) = 2b +a^2 =\sigma^2 +a^2

M3=∂t3I(0)∣t=0=∂t(2bI(0)+I(2))∣t=0M_3 = \partial_t^3I(0) \mid_{t=0} = \partial_t\left(2b I(0) + I(2) \right) \mid_{t=0}

Notice that ∂tI(0)∣t=0=a\partial_t I(0) \mid_{t=0} = a

and ∂tI(2)∣t=0=4bI(1)+I(3)=4ab+a3\partial_t I(2) \mid_{t=0} = 4bI(1)+I(3) = 4ab+a^3

so we will have M3=6ab+a3=a(6b+a2)M_3 = 6ab + a^3 = a(6b+a^2)

Notice that the central 3rd moment of this distribution has the following:

M3−3M2M1+2M13=a3+6ab−3(a2+2b)a+2a3=0M_3 -3 M_2 M_1 +2 M_1^3 = a^3 +6ab -3(a^2 +2b)a +2a^3=0

So that means the skewness of this "distribution" is zero.

We can get the distribution by using inverse Laplace transform (for characteristic function, we can use inverse Fourier transform)