rkt_ecdf {ROCket} | R Documentation |
Empirical estimate of the CDF
Description
Calculate an empirical cumulative distribution function based on a sample x
and optionally a vector w
of weights.
Usage
rkt_ecdf(x, w)
## S3 method for class 'rkt_ecdf'
print(x, ...)
## S3 method for class 'rkt_ecdf'
mean(x, ...)
## S3 method for class 'rkt_ecdf'
variance(x, ...)
## S3 method for class 'rkt_ecdf'
plot(x, ...)
Arguments
x |
Numeric vector containing the sample. Alternatively, if |
w |
Optional. Numeric vector containing the weights of each value in |
... |
Further parameters. |
Details
The weights vector w
can contain the counts of each distinct value in x
, this is the most natural use case.
In general the weights are describing the jumps of the final ecdf. Normalization is handled internally.
If x
contains duplicates, corresponding values in w
will be summed up.
Only positive weights are allowed. Elements in x
with non-positive weights will be ignored.
Value
A function of class rkt_ecdf
.
Examples
require(ROCket)
plot(rkt_ecdf(rnorm(100)))
plot(rkt_ecdf(c(0, 1)))
plot(rkt_ecdf(c(0, 1), c(1, 10)))