# Obtain the moments of a probability mass function?

GROUPS:
 I am trying to obtain the moments of this function via Probability Generating Function (PGF) or Moment Generating Function (MGF) but having problem with it. The pdf is ((Binomial[n, x])^v*\[Theta]^x*(1 - \[Theta])^(n - x))/\!$$\*UnderoverscriptBox[\(\[Sum]$$, $$i = 1$$, $$n$$]$$\*SuperscriptBox[\((Binomial[n, i])$$, $$v$$]* \*SuperscriptBox[$$\[Theta]$$, $$i$$]*\*SuperscriptBox[$$(1 - \[Theta])$$, $$n - i$$]\)\) I want to find the derivative of the PGF, with respect to t as expressed below and set t=1: that will give first moment. differentiating the second time and set t=1 gives second moment ....... D[\!$$\*UnderoverscriptBox[\(\[Sum]$$, $$x = 1$$, $$n$$]\*FractionBox[$$\*SuperscriptBox[\(t$$, $$x$$]\ \*SuperscriptBox[$$(1 - \[Theta])$$, $$n - x$$]\ \*SuperscriptBox[$$\[Theta]$$, $$x$$]\ \*SuperscriptBox[$$Binomial[n, x]$$, $$v$$]\), $$\*UnderoverscriptBox[\(\[Sum]$$, $$i = 1$$, $$n$$]\*SuperscriptBox[$$(1 - \[Theta])$$, $$\(-i$$ + n\)]\ \*SuperscriptBox[$$\[Theta]$$, $$i$$]\ \*SuperscriptBox[$$Binomial[n, i]$$, $$v$$]\)]\), t] I document is attached for details if this code is not clear enough. Thanks for your kindness. Olorire Attachments:
1 year ago
5 Replies
 If you set specific integer values for v, you'll get results and be able to see the pattern.
1 year ago
 Alright, we can choose specific values for v, like -10, -5, 1, 5, 10 and see the pattern. I will also try it here. Thanks for your ideal.
 Jim Baldwin 1 Vote Playing around with this a bit and trying different values of k suggests that the general formula for the i-th moment is given by m[i_, n_, k_, \[Theta]_] := - FactorialPower[n, i]^k \[Theta]^i HypergeometricPFQ[ConstantArray[i - n, k], ConstantArray[i + 1, k - 1], (-1)^(k - 1) \[Theta]/(-1 + \[Theta])]/ ((i!)^(k - 1) (-1 + \[Theta])^i (-1 + HypergeometricPFQ[ConstantArray[-n, k], ConstantArray[1, k - 1], (-1)^(k - 1) \[Theta]/(-1 + \[Theta])])) 
 The brute force method is just to write a single function covering all moments. For the k-th momement one could use moment[k_, n_, v_, \[Theta]_] := (D[\!$$\*UnderoverscriptBox[\(\[Sum]$$, $$x = 1$$, $$n$$] \*FractionBox[$$\*SuperscriptBox[\(t$$, $$x$$]\ \*SuperscriptBox[$$(1 - \[Theta])$$, $$n - x$$]\ \*SuperscriptBox[$$\[Theta]$$, $$x$$]\ \*SuperscriptBox[$$Binomial[n, x]$$, $$v$$]\), $$\*UnderoverscriptBox[\(\[Sum]$$, $$i = 1$$, $$n$$] \*SuperscriptBox[$$(1 - \[Theta])$$, $$\(-i$$ + n\)]\ \*SuperscriptBox[$$\[Theta]$$, $$i$$]\ \*SuperscriptBox[$$Binomial[n, i]$$, $$v$$]\)]\), {t, k}]) /. t -> 1 which in Mathematica looks likeThat can be used to check the function I defined previously.