Home > wafo > wstats > empdistr.m

# empdistr

## PURPOSE

Computes and plots the empirical CDF

## SYNOPSIS

[Fz] = empdistr(z,varargin)

## DESCRIPTION

EMPDISTR Computes and plots the empirical CDF
and optionally compares it with distribution G.

CALL:  F = empdistr(X,G,plotflag,sym);

F  = empirical distribution of X, two column matrix.
X  = data vector.
G  = cdf, two column matrix (optional).
plotflag = 0  no plotting
1 plot cdf F(x) (default)
2 plot 1-F(x) on a semilog y-scale
3 plot 1-F(x) on a log log scale
sym = {s1,s2} cell array or comma separated list of plot
symbols for F and G, respectively.
(default {'b','r--'})

NOTE:  SYM can be given anywhere after X

Example:
R = wgevrnd(.8,1,11,1,100);
x = linspace(5,15,200);
empdistr(R,[x;wgevcdf(x,.8,1,11)]','g')

## CROSS-REFERENCE INFORMATION

This function calls:
 cempdistr Computes and plots the conditional empirical CDF error Display message and abort function.
This function is called by:
 Chapter3 % CHAPTER3 Demonstrates distributions of wave characteristics Chapter5 % CHAPTER5 contains the commands used in Chapter 5 of the tutorial dat2tr Estimate transformation, g, from data. recfig11 Probability of exceeding H: Model (dash); data (dots) recfig12 Probability of exceeding V: Model (dash); data (dots) wbetafit Parameter estimates for Beta data. wchi2fit Parameter estimates for Chi squared data. wexpfit Parameter estimates for Exponential data. wexpplot Plots data on a Exponential distribution paper wgamfit Parameter estimates for Gamma data. wgevfit Parameter estimates for GEV data wggamfit Parameter estimates for Generalized Gamma data. wgpdfit Parameter estimates for Generalized Pareto data wgumbfit Parameter estimates for Gumbel data. wgumbplot Plots data on a Gumbel distribution paper. winvgfit Parameter estimates for Inverse Gaussian data. wlognfit Parameter estimates for Lognormal data. wnormfit Parameter estimates for Normal data. wraylfit Parameter estimates for Rayleigh data. wraylplot Plots data on a Rayleigh distribution paper wtfit Parameter estimates for Student's T data. wtraylfit Parameter estimates for Truncated Rayleigh data. wtweibfit Parameter estimates for truncated Weibull data. wweibfit Parameter estimates for Weibull data. wweibplot Plots data on a Weibull distribution paper

## SOURCE CODE

001 function [Fz] = empdistr(z,varargin)
002 %EMPDISTR Computes and plots the empirical CDF
003 %          and optionally compares it with distribution G.
004 %
005 %  CALL:  F = empdistr(X,G,plotflag,sym);
006 %
007 %        F  = empirical distribution of X, two column matrix.
008 %        X  = data vector.
009 %        G  = cdf, two column matrix (optional).
010 %  plotflag = 0  no plotting
011 %             1 plot cdf F(x) (default)
012 %             2 plot 1-F(x) on a semilog y-scale
013 %             3 plot 1-F(x) on a log log scale
014 %       sym = {s1,s2} cell array or comma separated list of plot
015 %             symbols for F and G, respectively.
016 %             (default {'b','r--'})
017 %
018 % NOTE:  SYM can be given anywhere after X
019 %
020 % Example:
021 %   R = wgevrnd(.8,1,11,1,100);
022 %   x = linspace(5,15,200);
023 %   empdistr(R,[x;wgevcdf(x,.8,1,11)]','g')
024 %
026
027 % Tested on: Matlab 5.3, 5.2, 5.1
028 % History:
029 % revised pab 25.10.2000
030 %  - made call to cempdistr instead -> making maintainence easier.
031 % revised pab 07.03.2000
032 % - enabled so that f may be empty while plotflag is given
033 % modified by Per A. Brodtkorb 10.11.98
034 % to accept both pdf and cdf's. Also enabled new plotting features,
035 % plotting of  probability of exceedances on a semilogy paper ....
036 % revised ms 13.06.2000
037 % - pdf usage removed (can't distinguish between a cdf and an increasing pdf)
038 % - changed axis labelling in figures
039 % - changed to staircaseplot when plotflag=2,3
040 % - revised header info
041 % - moved the conditional version to cempdistr
042
043
044 error(nargchk(1,5,nargin))
045 Fz1 = cempdistr(z,-inf,varargin{:});
046 if nargout>0
047   Fz=Fz1;
048 end
049 return
050
051
052
053
054
055
056
057
058

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