# Thread: Finding moments of 'difficult' distribution

1. ## Finding moments of 'difficult' distribution

Hello,

I think I'm missing something silly here, but I'm stuck in a rut - a push would be appreciated.

I'm working with this distribution $f(x\mid\theta) = 2\theta^{-2}x^3exp(-x^2/\theta) (x > 0)$

I want to find the mean and variance. Often it's easy to convert $\int\f(x)dx$ into something that looks like $moment*\int\tilde{f(x)}$ where $\tilde{f(x)}dx$ is some pdf and therefore integrates to 1.

I didn't see a solution like this, so I went brute force and just tried to integrate it figuring it's probably not the most elegant way, but it should work.

using 'by parts':
$\int_{0}^\infty x\cdot2\theta^{-2}x^3exp(-x^2/\theta)dx$
$2\theta^{-2}\int_{0}^\infty x^4exp(-x^2/\theta)dx$
$2\theta^{-2}[-\frac{\theta}{2}x^3exp(-x^2/\theta) + \int_{0}^\infty2x^2\theta exp(-x^2/\theta)dx]$
I then try to do by parts again, but it's already clear that when I later go to evaluate the result between 0 and $\infty$ the first x^3 term will blow up and there aren't any other convenient x^3 terms to cancel it out later.

Thanks!

2. Originally Posted by reflex
Hello,

I think I'm missing something silly here, but I'm stuck in a rut - a push would be appreciated.

I'm working with this distribution $f(x\mid\theta) = 2\theta^{-2}x^3exp(-x^2/\theta) (x > 0)$

I want to find the mean and variance. Often it's easy to convert $\int\f(x)dx$ into something that looks like $moment*\int\tilde{f(x)}$ where $\tilde{f(x)}dx$ is some pdf and therefore integrates to 1.

I didn't see a solution like this, so I went brute force and just tried to integrate it figuring it's probably not the most elegant way, but it should work.

using 'by parts':
$\int_{0}^\infty x\cdot2\theta^{-2}x^3exp(-x^2/\theta)dx$
$2\theta^{-2}\int_{0}^\infty x^4exp(-x^2/\theta)dx$
$2\theta^{-2}[-\frac{\theta}{2}x^3exp(-x^2/\theta) + \int_{0}^\infty2x^2\theta exp(-x^2/\theta)dx]$
I then try to do by parts again, but it's already clear that when I later go to evaluate the result between 0 and $\infty$ the first x^3 term will blow up and there aren't any other convenient x^3 terms to cancel it out later.

Thanks!
If you make a change of variable your problem is essentially to find $\int_{0}^{+\infty} u^n e^{u^2} \, du$ for u = 4 and u = 5. I suggest you research the gamma function.

3. Will do, thanks! (I remember seeing that somewhere in my notes).

Out of curiosity, why did my method fail? Shouldn't it come out the same, even if the change of variable cleans it up?

4. Originally Posted by reflex
Will do, thanks! (I remember seeing that somewhere in my notes).
Out of curiosity, why did my method fail? Shouldn't it come out the same, even if the change of variable cleans it up?
Originally Posted by reflex
[snip]
using 'by parts':
$\int_{0}^\infty x\cdot2\theta^{-2}x^3exp(-x^2/\theta)dx$
$2\theta^{-2}\int_{0}^\infty x^4exp(-x^2/\theta)dx$
$2\theta^{-2}[-\frac{\theta}{2}x^3exp(-x^2/\theta) + \int_{0}^\infty2x^2\theta exp(-x^2/\theta)dx]$
I then try to do by parts again, but it's already clear that when I later go to evaluate the result between 0 and $\infty$ the first x^3 term will blow up and there aren't any other convenient x^3 terms to cancel it out later.

Thanks!
The first term does not blow up. Use limits etc. to get zero.

5. Yes... I see now, I don't know what I was thinking...That was pretty silly. Thanks! (Although, I'm glad I asked, the substitution is a much better method.)