cfE_Empirical: Characteristic function of the EMPIRICAL distribution, based...

View source: R/cfE_Empirical.R

cfE_EmpiricalR Documentation

Characteristic function of the EMPIRICAL distribution, based on the observed data

Description

That is, cf(t) = (1/N)*(cfD(data_1*t) +...+ cfD(data_N*t)), where cfD(t) represents the characteristic function of the DIRAC RV concentrated at the constant d=1, i.e. cfD(t) = exp(1i*t).

cfE_Empirical(t, data, cfX) evaluates the compound characteristic function cf(t) = cfE_Empirical(-1i*log(cfX(t)),data) = (1/N) * sum_{j=1}^N cfX(t)^data_j; where cfX is function handle of the characteristic function cfX(t) of the random variable X.

Usage

cfE_Empirical(t, data, cfX)

Arguments

t

vector or array of real values, where the CF is evaluated.

data

vector of data, i.e. constants where the DIRAC RVs are concentrated. If empty, default value is data = 1.

cfX

function handle of the characteristic function of a random variable X. If cfX is non-empty, a compound CF is evaluated as cf(t) = cf(-1i*log(cfX(t)),data).

Value

Characteristic function cf(t) of the EMPIRICAL distribution, based on the observed data.

Note

Ver.: 23-Sep-2018 14:40:43 (consistent with Matlab CharFunTool v1.3.0, 15-Sep-2018 12:56:00).

References

WITKOVSKY V., WIMMER G., DUBY T. (2017). Computing the aggregate loss distribution based on numerical inversion of the compound empirical characteristic function of frequency and severity. arXiv preprint arXiv:1701.08299.

See Also

For more details see WIKIPEDIA: https://en.wikipedia.org/wiki/Empirical_characteristic_function.

Other Empirical Probability Distribution: cfE_DiracMixture(), cfE_EmpiricalOgive()

Examples

## EXAMPLE1
# Empirical CF - a weighted mixture of independent Dirac variables
set.seed(101)
n <- 1000
data <- c(rnorm(3 * n, 5, 0.2), rt(n, 3), rchisq(n, 1))
t <- seq(-50, 50, length.out = 2 ^ 10)
plotReIm(function(t)
        cfE_Empirical(t, data),
        t,
        title = "Empirical CF - CF of the mixture of Dirac random variables")

## EXAMPLE2
# Convolution of the ECF and the Gaussian kernel)
set.seed(101)
n <- 1000
data <- c(rnorm(3 * n, 5, 0.2), rt(n, 3), rchisq(n, 1))
bandwidth <- 0.25
cf_DATA   <- function(t)
        cfE_Empirical(t, data)
cf_KERNEL <- function(t)
        exp(-(bandwidth * t) ^ 2 / 2)
cf <- function(t)
        cf_DATA(t) * cf_KERNEL(t)
t <- seq(-50, 50, length.out = 2 ^ 10)
plotReIm(cf, t, title = "Smoothed Empirical CF")
result <- cf2DistGP(cf)

## EXAMPLE3
# (PDF/CDF of the compound Empirical-Empirical distribution)
set.seed(101)
lambda <- 25
nN <- 10
Ndata <- rpois(nN, lambda)

mu <- 0.1
sigma <- 2
nX <- 1500
Xdata <- rlnorm(nX, mu, sigma)
cfX <- function(t)
        cfE_Empirical(t, Xdata)
cf  <- function(t)
        cfE_Empirical(t, Ndata, cfX)
t <- seq(-0.2, 0.2, length.out = 2 ^ 10)
plotReIm(cf, t, title = "Compound Empirical CF")

x <- seq(0, 1000, length.out = 501)
prob <- c(0.9, 0.95)
options <- list()
options$N <- 2 ^ 10
options$SixSigmaRule <- 10
result <- cf2DistGP(cf, x, prob, options)

gajdosandrej/CharFunToolR documentation built on June 3, 2024, 7:46 p.m.