Statistics Toolbox    
ecdf

Empirical (Kaplan-Meier) cumulative distribution function

Syntax

Description

[f,x] = ecdf(y) calculates the Kaplan-Meier estimate of the cumulative distribution function (cdf), also known as the empirical cdf. y is a vector of data values. f is a vector of values of the empirical cdf evaluated at x.

[f,x,flo,fup] = ecdf(y) also returns lower and upper confidence bounds for the cdf. These bounds are calculated using Greenwood's formula, and are not simultaneous confidence bounds.

[...] = ecdf(y,'param1',value1,'param2',value2,...) specifies additional parameter name-value pairs chosen from the following:

'censoring'
Boolean vector of the same size as x. Elements are 1 for observations that are right-censored and 0 for observations that are observed exactly. Default is all observations observed exactly.
'frequency'
Vector of the same size as x containing non-negative integer counts. The jth element of this vector gives the number of times the jth element of x was observed. Default is 1 observation per element of x.
'alpha'
Value between 0 and 1 for a confidence level of 100*(1-alpha)%. Default is alpha=0.05 for 95% confidence.
'function'
Type of function returned as the f output argument, chosen from 'cdf' (default), 'survivor', or 'cumulative hazard'.

Examples

Generate random failure times and random censoring times, and compare the empirical cdf with the known true cdf.

See Also

cdfplot

References

[1]  Cox, D.R. and D. Oakes, Analysis of Survival Data, Chapman & Hall, London, 1984.


  dummyvar errorbar