Home > wafo > wstats > wgpdfit_ml.m

wgpdfit_ml

PURPOSE ^

Internal routine for wgpdfit (ML estimates for GPD data)

SYNOPSIS ^

[f,k,s] = wgpdfit_ml(x,data)

DESCRIPTION ^

 WGPDFIT_ML Internal routine for wgpdfit (ML estimates for GPD data) 
 
  CALL:  [f,k,s] = wgpdfit_ml(x,data)
 
  f = function values.
  k = shape parameter of GPD.
  s = scale parameter of GPD.
 
  This function is used by wgpdfit for numerical solution of 
  the ML estimate, i.e. solve f=0 for x.
    data = wgpdrnd(0.3,1,0,200,1);
    x_ML = fzero('wgpdfit_ml',0,[],data);
    [f,k_ML,s_ML] = wgpdfit_ml(x_ML,data)  % Estimates k_ML and s_ML
 
  See also  wgpdfit

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [f,k,s] = wgpdfit_ml(x,data)
002 %WGPDFIT_ML Internal routine for wgpdfit (ML estimates for GPD data) 
003 %
004 % CALL:  [f,k,s] = wgpdfit_ml(x,data)
005 %
006 % f = function values.
007 % k = shape parameter of GPD.
008 % s = scale parameter of GPD.
009 %
010 % This function is used by wgpdfit for numerical solution of 
011 % the ML estimate, i.e. solve f=0 for x.
012 %   data = wgpdrnd(0.3,1,0,200,1);
013 %   x_ML = fzero('wgpdfit_ml',0,[],data);
014 %   [f,k_ML,s_ML] = wgpdfit_ml(x_ML,data)  % Estimates k_ML and s_ML
015 %
016 % See also  wgpdfit
017 
018 % References
019 %
020 %  Davidson & Smith (1990)
021 %  Models for Exceedances over high Threholds.
022 %  Journal of the Royal Statistical Society B,52, pp. 393-442.
023 
024 % Tested on; Matlab 5.3
025 % History: 
026 % Created by PJ 22-Jun-2000
027 % Revised by PJ 10-Oct-2000
028 % - Help text added w*
029 
030 % In order to avoid boundary problems in numerical solution we use a transformation
031 %   Transformation: x = log(1/max_data - t),   -Inf < t < 1/max_data
032 %   Inverse Trans.: t = 1/max(data) - exp(x),  -Inf < x < Inf
033 
034 t = 1/max(data) - exp(x); % Inverse Transformation
035 
036 N = length(data);
037 
038 k = -1/N*sum(log(1-t*data)); % Shape parameter
039 s = k/t;                     % Scale parameter
040 
041 % Evaluate function
042 f = (1/k-1)*sum(data./(1-t*data)) - N/t; 
043

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003