PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_univar_estim_genpareto (g07bf)
Purpose
nag_univar_estim_genpareto (g07bf) estimates parameter values for the generalized Pareto distribution by using either moments or maximum likelihood.
Syntax
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 .
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
Parameters
Compulsory Input Parameters
- 1:
– double array
-
The observations
, for , assumed to follow a generalized Pareto distribution.
- 2:
– int64int32nag_int scalar
-
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 .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the array
y.
The number of observations.
Constraint:
.
Output Parameters
- 1:
– double scalar
-
The parameter estimate .
- 2:
– double scalar
-
The parameter estimate .
- 3:
– double array
-
The variance-covariance of the asymptotic Normal distribution of and . contains the variance of ; contains the variance of ; and contain the covariance of and .
- 4:
– double array
-
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 .
- 5:
– double scalar
-
If maximum likelihood estimates are requested,
ll contains the log-likelihood value
at the end of the optimization; otherwise
ll is set to
.
- 6:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
Constraint: .
-
-
Constraint: for all .
-
-
Constraint: , , or .
- W
-
The asymptotic distribution is not available for the returned parameter estimates.
- W
-
The distribution of maximum likelihood estimates cannot be calculated for the returned parameter estimates because the Hessian matrix could not be inverted.
- W
-
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.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
Not applicable.
Further Comments
The search for maximum likelihood parameter estimates is further restricted by requiring
as this avoids the possibility of making the log-likelihood
arbitrarily high.
Example
This example calculates parameter estimates for observations assumed to be drawn from a generalized Pareto distribution.
Open in the MATLAB editor:
g07bf_example
function g07bf_example
fprintf('g07bf example results\n\n');
optopt = int64(2);
warn_state = nag_issue_warnings();
nag_issue_warnings(true);
wstat = warning();
warning('OFF');
y = [1.5800; 0.1390; 2.3624; 2.9435; 0.1363; 0.9688; 0.6585; 2.8011; ...
0.9880; 1.7887; 0.0630; 0.3862; 1.5130; 0.0669; 1.3659; 0.4256; ...
0.3485; 27.8760; 5.2503; 1.1028; 0.5273; 1.3189; 0.6490];
[xi, beta, asvc, obsvc, ll, ifail] = ...
g07bf(y, optopt);
if ifail == 0 || (ifail > 5 && ifail < 9)
fprintf('xi %14.6f\n', xi);
fprintf('beta %14.6f\n\n', beta);
if optopt > 0
if (ifail == 7 || ifail == 8)
fprintf('Invalid observed distribution\n');
else
fprintf('Observed distribution\n');
fprintf('Var(xi) %14.6f\n', obsvc(1));
fprintf('Var(beta) %14.6f\n', obsvc(4));
fprintf('Covar(xi,beta) %14.6f\n', obsvc(2));
fprintf('Final log-likelihood: %14.6f\n\n', ll);
end
else
if (ifail == 6 || ifail == 7)
fprintf('Invalid asymptotic distribution\n');
else
fprintf('Asymptotic distribution\n');
fprintf('Var(xi) %14.6f\n', asvc(1));
fprintf('Var(beta) %14.6f\n', asvc(4));
fprintf('Covar(xi,beta) %14.6f\n', asvc(2));
end
end
end
warning(wstat);
nag_issue_warnings(warn_state);
g07bf example results
xi 0.540439
beta 1.040549
Observed distribution
Var(xi) 0.079932
Var(beta) 0.119872
Covar(xi,beta) -0.045509
Final log-likelihood: -36.344327
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015