# Estimating the MGF of a distribution from its samples

I have $N$ samples from a random variable $X$ that has an unknown distribution, and I want to see if it fits with the available proposed distributions of this RV. However, there are no closed-form expressions for the proposed distrubtions, only plots of their moment generating functions (MGFs), defined as $\mathbb{E}[e^{ux}]$, so how can I estimate the MGF of this distribution (as a function of $u$) from the available samples?

Note: I need to plot the estimated MGF of the distribution vs the parameter $u$.

• Can you just plot $n^{-1} \sum_{i=1}^{n} e^{u x_i}$? – dsaxton Sep 12 '16 at 20:30

If the MGF exists in a neighborhood of $t$, then asymptotically $\overline{\exp(tX)}$ should converge to $E(\exp(tX))$ there (under the conditions for the weak law of large numbers, you'll have convergence to the expectation in probability and under the conditions for the strong law you'll have almost sure convergence).
Which is to say (as dsaxton suggested in comments) $\frac{1}{n} \sum_{1=1}^n \exp(tx_i)$ would be the obvious estimate of $M_X(t)$.
That doesn't imply much about when the sample size will be large enough for a useful estimate (which will vary with the distribution of $X$ and with the value of $t$), but it does suggest a way to estimate the MGF over a range of values of $t$. Since it's the behavior of the MGF in the neighborhood of 0 that's usually of interest, that would presumably where you will mostly want to focus the attention.
With that in mind it might be worth considering some kind of interval on the estimate of $E(\exp(tX))$ (/ bounds on the mgf) at given values of $t$, as well as the estimate itself.