Learn R Programming

ROCket (version 1.0.3)

rkt_ecdf: 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 rkt_ecdf print(x, ...)

# S3 method for rkt_ecdf mean(x, ...)

# S3 method for rkt_ecdf variance(x, ...)

# S3 method for rkt_ecdf plot(x, ...)

Value

A function of class rkt_ecdf.

Arguments

x

Numeric vector containing the sample. Alternatively, if w is supplied, distinct values within the sample. For S3 methods, a function of class rkt_ecdf.

w

Optional. Numeric vector containing the weights of each value in x.

...

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.

Examples

Run this code
require(ROCket)

plot(rkt_ecdf(rnorm(100)))
plot(rkt_ecdf(c(0, 1)))
plot(rkt_ecdf(c(0, 1), c(1, 10)))

Run the code above in your browser using DataLab