*
* Displays a mean excess plot for a series
*
* @MePlot( options ) series start end
*
* Parameters:
*   series      series to analyze
*   start end   range to analyze
*
* Options:
*   SMPL=series with zeros in entries to skip [use all]
*   TITLE=" title for graph "
*
* Revision Schedule:
*  03/07 Written by Tom Doan, Estima. Requires RATS 6.35 or later.
*
procedure MePlot series start end
option series smpl
option string title
*
local series copy me
local integer n
*
* Use SAMPLE to strip out values to skip and shift down to entry 1
*
sample(smpl=smpl) series start end copy 1
compute n=%nobs
*
* Sort the series in decreasing order
*
order(decreasing) copy 1 n
*
* Compute the running sums
*
acc copy 1 n me
*
* Use the observed values of "copy" as the evaluation points
*
set me 1 n = me/t-copy
*
* Restrict the graph to omit the most extreme 1% of possible values on either end
*
stats(fractiles,noprint) copy 1 n
scatter(smpl=copy>=%fract01.and.copy<=%fract99,header=title,$
  hlabel="Threshold",vlabel="Mean Excess")
# copy me 1 n
end






