empirical_cdf: Empirical Cumulative Distribution Function

Description Usage Arguments Details Examples

Description

Given a vector x, calculate P(x <= X) for a set of upper bounds X. Can be applied to a data.table object for multivariate use. That is, calculate P(x <= X, y <= Y, z <= Z, ...)

Usage

1
empirical_cdf(x, ubounds)

Arguments

x

Numeric vector or a data.table object for multivariate use.

ubounds

A vector of upper bounds on which to evaluate the CDF. For multivariate version, a data.table whose names correspond to columns of x.

Details

Calculate the empirical CDF of a vector, or data.table with multiple columns for multivariate use.

Examples

1
2
3
4
library(data.table)
dt <- data.table(x=c(0.3, 1.3, 1.4, 3.6), y=c(1.2, 1.2, 3.8, 3.9))
empirical_cdf(dt$x, ubounds=1:4)
empirical_cdf(dt, ubounds=CJ(x = 1:4, y = 1:4))

mltools documentation built on May 2, 2019, 5:22 a.m.