cfE_DiracMixture: Characteristic function of the weighted mixture distribution...

View source: R/cfE_DiracMixture.R

cfE_DiracMixtureR Documentation

Characteristic function of the weighted mixture distribution of independent DIRAC random variables concentrated at the fixed constants

Description

Characteristic function of the weighted mixture distribution of independent DIRAC random variables D_1,...,D_N, concentrated at the fixed constants (data) given by the vector d = (d_1,...,d_N).

That is, cf(t) = weight_1*cfD(d_1*t) +...+ weight_N*cfD(d_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_DiracMixture(t, d, weight, cfX) evaluates the compound characteristic function

cf(t) = cfE_DiracMixture(-1i*log(cfX(t)),d,weight) = weight_1*cfX(t)^d_1 +...+ weight_N*cfX(t)^d_N

where cfX denotes the function handle of the characteristic function cfX(t) of the random variable X.

Usage

cfE_DiracMixture(t, d, weight, cfX)

Arguments

t

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

d

vector of constants (data) where the DIRAC RVs are concentrated. If empty, default value is d = 1.

weight

vector of weights of the distribution mixture. If empty, default value is weight = 1/length(d).

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)),d,weight).

Value

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

Note

Ver.: 23-Sep-2018 14:59:46 (consistent with Matlab CharFunTool v1.3.0, 23-Jun-2017 10:00:49).

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_EmpiricalOgive(), cfE_Empirical()

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)
weights <- 1 / length(data)
plotReIm(function(t)
        cfE_DiracMixture(t, data, weights),
        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_DiracMixture(t, data, weights)}
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_DiracMixture(t, Xdata, 1 / nX)
cf  <- function(t)
        cfE_DiracMixture(t, Ndata, 1 / nN, 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.