# Required: Method of moments fitting routine for the two-parameter generalized Pareto

I am currently using the evd package which fits a two-parameter GPD by maximum likelihood. Since in small samples the MOM is superior to the ML estimation I'd like to give it a go. However, the POT package - which could do the job - is offline due to memory access errors.

There are many extreme value packages around. However I am ONLY interested in the two-parameter GPD given by

$G(y)= \begin{cases} 1-\left(1+ \frac{\xi y}{\beta} \right)^{-\frac{1}{\xi}} & \xi \neq 0 \\ 1-\exp\left(-\frac{y}{\beta}\right) & \xi=0 \end{cases}$

or alternatively

$g(y)= \begin{cases} \frac{1}{\beta} \left( 1+\frac{\xi y}{\beta} \right)^{-1-\frac{1}{\xi}} & \xi \neq 0 \\ \frac{1}{\beta} \exp\left(-\frac{y}{\beta} \right) & \xi=0 \end{cases}$

Is there any package that can fit such a distribution using a method of moments approach?

-
Do you have any reference or source for the statement "in small samples the MOM is superior to the ML estimation" in the case of the GPD? (It relates to another question here - one of mine, as it happens.) –  Glen_b Jun 25 at 23:26
See here: Hosking(1987) -- Parameter and Quantile Estimation for the Generalized Pareto Distribution. There seem to be quite a few typos in this paper though. –  Joz Jun 25 at 23:31
Thank you very much. This is the Hosking and Wallis paper in Technometrics? –  Glen_b Jun 25 at 23:34
Jep, that's the one. –  Joz Jun 25 at 23:37

As the case when $\xi = 0$ simply corresponds to an exponential distribution with scale parameter $\beta$, it is trivial to compute the method of moments estimator given $\overline y$, the first sample raw moment (the second is not needed since there is only one parameter to estimate in this case). For the case $\xi < 1/2$ with $\xi \ne 0$, we can easily calculate $${\rm E}[Y] = \frac{\beta}{1-\xi}, \quad {\rm E}[Y^2] = \frac{2\beta^2}{(1-\xi)(1-2\xi)},$$ which shows that the first and second raw moments of $Y$ are defined only if $\xi < 1/2$. Consequently, setting these to their respective sample moments and solving for the parameters easily yields the closed form solution $$\widehat{\beta} = \frac{\overline y \overline{y^2}}{2(\overline{y^2} - (\overline y)^2)}, \quad \widehat{\xi} = \frac{1}{2} - \frac{(\overline y)^2}{2(\overline{y^2} - (\overline y)^2)},$$ where $\overline{y^2} = \frac{1}{n} \sum_{i=1}^n y_i^2$ is the second sample raw moment.
(+1) The raw moments are defined even for negative values of $\xi$, not just $0\lt \xi\lt 1/2$, with the same solution. –  whuber Jun 25 at 21:52
It can be confusing because the PDF and CDF as given in the question are not quite correct: for $\xi\gt 0$ both are zero for $y\lt 0$ and for $\xi\lt 0$ they are supported only on the interval $[0, -\beta/\xi)$. –  whuber Jun 25 at 22:13
Unless $n$ is very small the results should be similar, since the usual (i.e. Bessel corrected) sample variance and $\overline{y^2} - (\overline y)^2$ are the same up to a factor of $\frac{n-1}{n}$. –  Glen_b Jun 25 at 23:32