NAG Library Routine Document
g07bff (estim_genpareto)
1
Purpose
g07bff estimates parameter values for the generalized Pareto distribution by using either moments or maximum likelihood.
2
Specification
Fortran Interface
Integer, Intent (In) | :: | n, optopt | Integer, Intent (Inout) | :: | ifail | Real (Kind=nag_wp), Intent (In) | :: | y(n) | Real (Kind=nag_wp), Intent (Out) | :: | xi, beta, asvc(4), obsvc(4), ll |
|
C Header Interface
#include <nagmk26.h>
void |
g07bff_ (const Integer *n, const double y[], const Integer *optopt, double *xi, double *beta, double asvc[], double obsvc[], double *ll, Integer *ifail) |
|
3
Description
Let the distribution function of a set of
observations
be given by the generalized Pareto distribution:
where
- and
- , when ;
- , when .
Estimates
and
of the parameters
and
are calculated by using one of:
- method of moments (MOM);
- probability-weighted moments (PWM);
- maximum likelihood estimates (MLE) that seek to maximize the log-likelihood:
The variances and covariance of the asymptotic Normal distribution of parameter estimates
and
are returned if
satisfies:
- for the MOM;
- for the PWM method;
- for the MLE method.
If the MLE option is exercised, the observed variances and covariance of and is returned, given by the negative inverse Hessian of .
4
References
Hosking J R M and Wallis J R (1987) Parameter and quantile estimation for the generalized Pareto distribution Technometrics 29(3)
McNeil A J, Frey R and Embrechts P (2005) Quantitative Risk Management Princeton University Press
5
Arguments
- 1: – IntegerInput
-
On entry: the number of observations.
Constraint:
.
- 2: – Real (Kind=nag_wp) arrayInput
-
On entry: the observations
, for , assumed to follow a generalized Pareto distribution.
- 3: – IntegerInput
-
On entry: determines the method of estimation, set:
- For the method of probability-weighted moments.
- For the method of moments.
- For maximum likelihood with starting values given by the method of moments estimates.
- For maximum likelihood with starting values given by the method of probability-weighted moments.
Constraint:
, , or .
- 4: – Real (Kind=nag_wp)Output
-
On exit: the parameter estimate .
- 5: – Real (Kind=nag_wp)Output
-
On exit: the parameter estimate .
- 6: – Real (Kind=nag_wp) arrayOutput
-
On exit: the variance-covariance of the asymptotic Normal distribution of and . contains the variance of ; contains the variance of ; and contain the covariance of and .
- 7: – Real (Kind=nag_wp) arrayOutput
-
On exit: if maximum likelihood estimates are requested, the observed variance-covariance of and . contains the variance of ; contains the variance of ; and contain the covariance of and .
- 8: – Real (Kind=nag_wp)Output
-
On exit: if maximum likelihood estimates are requested,
ll contains the log-likelihood value
at the end of the optimization; otherwise
ll is set to
.
- 9: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry, .
Constraint: .
-
On entry, .
Constraint: for all .
-
On entry, .
Constraint: , , or .
-
The asymptotic distribution is not available for the returned parameter estimates.
-
The distribution of maximum likelihood estimates cannot be calculated for the returned parameter estimates because the Hessian matrix could not be inverted.
-
The asymptotic distribution of parameter estimates is invalid and the distribution of maximum likelihood estimates cannot be calculated for the returned parameter estimates because the Hessian matrix could not be inverted.
-
The optimization of log-likelihood failed to converge; no maximum likelihood estimates are returned. Try using the other maximum likelihood option by resetting
optopt. If this also fails, moments-based estimates can be returned by an appropriate setting of
optopt.
-
Variance of data in
y is too low for method of moments optimization.
-
The sum of
y is zero within
machine precision.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
Not applicable.
8
Parallelism and Performance
g07bff is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g07bff makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
The search for maximum likelihood parameter estimates is further restricted by requiring
as this avoids the possibility of making the log-likelihood
arbitrarily high.
10
Example
This example calculates parameter estimates for observations assumed to be drawn from a generalized Pareto distribution.
10.1
Program Text
Program Text (g07bffe.f90)
10.2
Program Data
Program Data (g07bffe.d)
10.3
Program Results
Program Results (g07bffe.r)