rkt_ecdf: Empirical estimate of the CDF

Description Usage Arguments Details Value Examples

View source: R/rkt_ecdf.R

Description

Calculate an empirical cumulative distribution function based on a sample x and optionally a vector w of weights.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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 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.

Value

A function of class rkt_ecdf.

Examples

1
2
3
4
5
require(ROCket)

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

ROCket documentation built on Feb. 17, 2021, 5:07 p.m.