emp.cdf {ssM8}R Documentation

Empirical Cumulative Distribution Function

Description

Calculates the empirical cumulative probability distribution function. This is the inverse function of quantile.

Usage

emp.cdf(x, q)

Arguments

x is a vector containing the sample data.
q is a vector of points where the function is to be evaluated.

Details

This function is an exact inverse of the quantile function when the points in q are contained in x. This is not the case for the function ecdf.

For example, say x contains 11 unique points. Then according to the quantile function, the minimum represents the zero-th quantile, and the remaining sorted values represent the 10%ile, 20%ile, 30%ile, up to 100%ile. The function emp.cdf has been defined to be consistent with this.

This consistency is important for the evaluation of the M8 algorithm. The TIP declaration within the function M8.TIP is calculated by two different methods, one using the quantile function, and the other based on the empirical cumulative probability distribution function. If they are not consistent then the time point of the TIP declaration can be different between the two methods.

Value

A vector of the same length as q, containing the cumulative probabilities.

Author(s)

David Harte, 2005

See Also

quantile, ecdf

Examples

n <- 10
x <- rep(0:n, 1)
print(quantile(x, probs=seq(0, 1, 1/n)))
print(emp.cdf(x, x))

n <- 12
x <- rep(0:n, 3)
print(quantile(x, probs=seq(0, 1, 1/n)))
print(emp.cdf(x, x))

n <- 12
x <- rnorm(n+1)
print(quantile(x, probs=seq(0, 1, 1/n)))
print(sort(x))
print(emp.cdf(x, sort(x)))

[Package ssM8 version 2.1-3 Index]