Empirical cumulative distribution function.
This is a generic function; there currently exists a method for
resamp objects, described separately.
USAGE:
cdf(x, q, weights=NULL, na.rm=F, normalize=T)
REQUIRED ARGUMENTS:
x
numerical data.
q
numerical, values at which to compute the distribution function.
OPTIONAL ARGUMENTS:
weights
a vector the same length as
x, containing non-negative weights
(probabilities)
to define a distribution function with unequal jumps.
The weights are normalized to sum to 1.
na.rm
if
TRUE, missing values (
NA) in
x or
weights cause
the corresponding observations to be removed.
If
FALSE, missing values in
x and
weights are an error.
normalize
if
FALSE, then return the number (rather than proportion)
of the
x values less than or equal to each q,
or the sum of the corresponding unnormalized weights.
VALUE:
vector the same length as
q, containing F(
q), where F is
the empirical distribution function defined by data
x.
Missing values in
q cause missing values in the result.
SEE ALSO:
,
,
,
.
EXAMPLES:
x <- rnorm(20)
z <- seq(-3,3,by=.1)
cdf(x, z)
plot(z, cdf(x, z))
cdf(x, z, weights=1:20)
pdiscrete(z, x, weights=1:20)