View source: R/cfE_EmpiricalOgive.R
cfE_EmpiricalOgive | R Documentation |
cfE_EmpiricalOgive(t, bins, freq)
calculates characteristic function of the Ogive empirical distribution based
on the observed histogram (given by bins and frequencies).
That is, cf(t)
is given as a weighted mixture of the UNIFORM iid RVs.
cf(t) = cfE_EmpiricalOgive(t,bins,freq) = sum_{j=1}^n freq_j * cf_Uniform(t,bins_{j-1},bins_{j}),
where cf_Uniform(t,bin_{j-1},bin_{j})
is CF of the Uniform distribution on the interval [bins_{j-1},bins_j]
.
The bins and frequencies = counts/sum(counts) are based on the discretized/grouped
or histogram data, for more details see e.g. the R function hist
.
cfE_EmpiricalOgive(t, bins, freq)
t |
vector or array of real values, where the CF is evaluated. |
bins |
vector of breaks of histogram bins. |
freq |
frequencies for each bin of histogram. |
Characteristic function cf(t)
of the EMPIRICAL distribution, based on the observed data.
Ver.: 02-Oct-2018 14:07:43 (consistent with Matlab CharFunTool v1.3.0, 24-Jun-2017 09:34:15).
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.
For more details see WIKIPEDIA: https://en.wikipedia.org/wiki/Empirical_characteristic_function.
Other Empirical Probability Distribution:
cfE_DiracMixture()
,
cfE_Empirical()
## EXAMPLE1 (Ogive ECF - a weighted mixture of independent Uniform RVs)
set.seed(101)
n <- 1000
Data <- c(rnorm(3 * n, 5, 0.2), rt(n, 10))
Edges <- -6:6
Counts <- hist(x = Data, breaks = Edges)$counts
Xbins <- Edges
Xfreq <- Counts / sum(Counts)
t <- seq(-10, 10, length.out = 501)
bins <- Xbins
freq <- Xfreq
plotReIm(function(t) cfE_EmpiricalOgive(t, Xbins, Xfreq),
t, title = 'Ogive ECF of the grouped (histogram) data')
## EXAMPLE2 (PDF/CDF of the Ogive distribution)
set.seed(101)
n <- 1000
Data <- c(rnorm(3 * n, 5, 0.2), rt(n, 10))
Edges <- -6:6
Counts <- hist(x = Data, breaks = Edges)$counts
Xbins <- Edges
Xfreq <- Counts / sum(Counts)
cf <- function(t) cfE_EmpiricalOgive(t, Xbins, Xfreq)
x <- seq(-5, 7, length.out = 101)
prob <- c(0.9, 0.95)
options <- list()
options$N <- 2^12
options$SixSigmaRule <- 8
result <- cf2DistGP(cf, x, prob, options)
## EXAMPLE3 (PDF/CDF of the compound Poisson-Ogive distribution)
set.seed(101)
n <- 1000
Data <- c(rnorm(3 * n, 5, 0.2), rt(n, 10))
Edges <- -6:6
Counts <- hist(x = Data, breaks = Edges)$counts
Xbins <- Edges
Xfreq <- Counts / sum(Counts)
cfX <- function(t) cfE_EmpiricalOgive(t, Xbins, Xfreq)
lambda <- 15
cf <- function(t) cfN_Poisson(t, lambda, cfX)
x <- seq(0, 100, length.out = 101)
prob <- c(0.9, 0.95, 0.99)
options <- list()
options$isCompound <- TRUE
result <- cf2DistGP(cf, x, prob, options)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.