Solved – Moments from pdf

density functionmoments

I got confused reading about moments and their relationship with the pdf.

Given a pdf and the values of the parameters, can we calculate the moments of the distribution? More importantly, what is the formula for the second and third moment, (variance and skewness)?

I saw a formula for the variance with an integral minus the mean squared. Is this an integral over all the support of the pdf? What is the equivalent for the third moment?

Best Answer

The moments are defined in terms of integrals.

For continuous random variables

$E(X)=\int_{-\infty}^\infty x f(x) dx$

More generally:

$E(X^k)=\int_{-\infty}^\infty x^k f(x) dx$

$E[(X-\mu)^k]=\int_{-\infty}^\infty (x-\mu)^k f(x) dx$

See Wikipedia on Moments (mathematics).

Given a pdf and the values of the parameters, can we calculate the moments of the distribution?

If we can evaluate the relevant integral, yes.

More importantly, what is the formula for the second and third moment, (variance and skewness)?

The skewness of a random variable is not the third moment of that variable.

Wikipedia on skewness

Variance is the second central moment, so it follows from the formula I gave above by putting $k=2$.

I saw a formula for the variance with an integral minus the mean squared.

Yes, using basic properties of expectation, you can write $E[(X-\mu)^2]=E[X^2]-\mu^2$.

See Wikipedia on variance.

Is this an integral over all the support of the pdf?

Strictly the integral is over the real line, but the pdf is only non-zero within its support, so effectively, yes.

What is the equivalent for the third moment?

\begin{eqnarray} E[(X-\mu)^3]&=&E[(X^3-3\mu X^2+3\mu^2 X - \mu^3)]\\ &=&E(X^3)-3\mu E(X^2)+3\mu^2 E(X) - E(\mu^3)\\ &=&E(X^3)-3\mu E(X^2)+2\mu^3 \end{eqnarray}

The general case is given by Wikipedia in the article on central moments