NAG FL Interface
g07bff (estim_​genpareto)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

g07bff estimates parameter values for the generalized Pareto distribution by using either moments or maximum likelihood.

2 Specification

Fortran Interface
Subroutine g07bff ( n, y, optopt, xi, beta, asvc, obsvc, ll, ifail)
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 <nag.h>
void  g07bff_ (const Integer *n, const double y[], const Integer *optopt, double *xi, double *beta, double asvc[], double obsvc[], double *ll, Integer *ifail)
The routine may be called by the names g07bff or nagf_univar_estim_genpareto.

3 Description

Let the distribution function of a set of n observations
yi ,   i=1,2,,n  
be given by the generalized Pareto distribution:
F(y) = { 1- (1+ ξy β ) -1/ξ , ξ0 1-e-yβ , ξ=0;  
where
Estimates ξ^ and β^ of the parameters ξ and β are calculated by using one of:
The variances and covariance of the asymptotic Normal distribution of parameter estimates ξ^ and β^ are returned if ξ^ satisfies:
If the MLE option is exercised, the observed variances and covariance of ξ^ and β^ is returned, given by the negative inverse Hessian of L.

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: n Integer Input
On entry: the number of observations.
Constraint: n>1.
2: y(n) Real (Kind=nag_wp) array Input
On entry: the n observations yi, for i=1,2,,n, assumed to follow a generalized Pareto distribution.
Constraints:
  • y(i)0.0;
  • i=1 n y(i)>0.0.
3: optopt Integer Input
On entry: determines the method of estimation, set:
optopt=−2
For the method of probability-weighted moments.
optopt=−1
For the method of moments.
optopt=1
For maximum likelihood with starting values given by the method of moments estimates.
optopt=2
For maximum likelihood with starting values given by the method of probability-weighted moments.
Constraint: optopt=−2, −1, 1 or 2.
4: xi Real (Kind=nag_wp) Output
On exit: the parameter estimate ξ^.
5: beta Real (Kind=nag_wp) Output
On exit: the parameter estimate β^.
6: asvc(4) Real (Kind=nag_wp) array Output
On exit: the variance-covariance of the asymptotic Normal distribution of ξ^ and β^. asvc(1) contains the variance of ξ^; asvc(4) contains the variance of β^; asvc(2) and asvc(3) contain the covariance of ξ^ and β^.
7: obsvc(4) Real (Kind=nag_wp) array Output
On exit: if maximum likelihood estimates are requested, the observed variance-covariance of ξ^ and β^. obsvc(1) contains the variance of ξ^; obsvc(4) contains the variance of β^; obsvc(2) and obsvc(3) contain the covariance of ξ^ and β^.
8: ll Real (Kind=nag_wp) Output
On exit: if maximum likelihood estimates are requested, ll contains the log-likelihood value L at the end of the optimization; otherwise ll is set to -1.0.
9: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or −1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, n=value.
Constraint: n>1.
ifail=2
On entry, y(value)=value.
Constraint: y(i)0.0 for all i.
ifail=3
On entry, optopt=value.
Constraint: optopt=−2, −1, 1 or 2.
ifail=6
The asymptotic distribution is not available for the returned parameter estimates.
ifail=7
The distribution of maximum likelihood estimates cannot be calculated for the returned parameter estimates because the Hessian matrix could not be inverted.
ifail=8
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.
ifail=9
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.
ifail=10
Variance of data in y is too low for method of moments optimization.
ifail=11
The sum of y is zero within machine precision.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface 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.

9 Further Comments

The search for maximum likelihood parameter estimates is further restricted by requiring
1+ ξ^yi β^ > 0 ,  
as this avoids the possibility of making the log-likelihood L arbitrarily high.

10 Example

This example calculates parameter estimates for 23 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)