cfX_PDF | R Documentation |
cfX_PDF(t, pdfFun, method, tol)
computes the characteristic function of the continuos
distribution defined by its PDF function, pdfFun = function(x) pdf(x)
, here we assume x >= 0
,
computed for real vector argument t
.
cfX_PDF(t, pdfFun, method, tol)
t |
real vector, where the characteristic function CF(t) will be evaluated. |
pdfFun |
function handle used as the PDF function with the argument |
method |
set the method used to compute the characteristic function,
either |
tol |
relative tolerance parameter used in the built-in R numerical integration algorithm |
cfX_PDF
is based on the standard integral representation of the characteristic function
of the continuous distribution defined by its PDF (here PDF is represented by the function handle
pdfFun(x)
defined for x >= 0
). Then,
CF(t) = Integral_0^inf exp(i*t*x) * pdfFun(x) dx
. Alternatively, by using the half-space Fourier Integral Transformation (FIT), which could improve the highly oscillatory behaviour of the integrand function, we get
CF(t) = Integral_0^inf (i/t) * exp(-x) * pdfFun(i*x/t) dx.
If we define the integrand as funCF(t, x) = (i / t) * exp(-x) * pdfFun(i * x / t)
,
then by using a stabilizing transformation from [0,inf]
to [0,1]
,
we can evaluate the CF by the following (well behaved) integral:
CF(t) = Integral_0^1 2x/(1-x)^3 * funCF(t,(x/(1-x))^2) dx.
Selection of the proper method (standard definition or the integral transformation FIT) depends on the distribution and the particular form of its PDF.
cfX_PDF
evaluates this integral by using the R built in function integrate
,
with precission specified by tolerance tol (default value is tol = 1e-6
).
Returns values of characteristic function of the continuos distribution defined by its PDF function .
Ver.: 23-Sep-2018 16:55:18 (consistent with Matlab CharFunTool v1.3.0, 21-Jul-2017 20:53:22).
[1] WITKOVSKY, V.: On the exact computation of the density and of the quantiles of linear combinations of t and F random variables. Journal of Statistical Planning and Inference, 2001, 94, 1-13.
[2] WITKOVSKY, V.: Matlab algorithm TDIST: The distribution of a linear combination of Student's t random variables. In COMPSTAT 2004 Symposium (2004), J. Antoch, Ed., Physica-Verlag/Springer 2004, Heidelberg, Germany, pp. 1995-2002.
[3] WITKOVSKY, V., WIMMER, G., DUBY, T. Computing the aggregate loss distribution based on numerical inversion of the compound empirical characteristic function of frequency and severity. ArXiv preprint, 2017, arXiv:1701.08299.
[4] DUBY, T., WIMMER, G., WITKOVSKY, V.(2016). MATLAB toolbox CRM for computing distributions of collective risk models. Working Paper. Journal of Statistical Software. arXiv preprint arXiv:1801.02248, 2018.
Other CF Tool:
cf_Conv()
## EXAMPLE1 (CF of the Exponential distribution with mu = 1)
pdfFun <- function(x) exp(-x)
t <- seq(from = -20, to = 20, length.out = 2^10+1)
plotReIm(function(t) cfX_PDF(t, pdfFun), t,
'Characteristic function of the Exponential distribution')
## EXAMPLE2 (CF of the LogNormal distribution with mu = 0, sigma = 1)
mu <- 0
sigma <- 1
pdfFun <- function(x) exp(-0.5 * ((log(x) - mu) / sigma) ^ 2) / (x * sqrt(2 * pi) * sigma)
method <- 'fit'
t <- seq(from = -20, to = 20, length.out = 2^10+1)
plotReIm(function(t) cfX_PDF(t, pdfFun, method), t,
'Characteristic function of the LogNormal distribution')
## EXAMPLE3 (CDF/PDF of the LogNormal distribution with mu = 0, sigma = 1)
mu <- 0
sigma <- 1
pdfFun <- function(x) exp(-0.5 * ((log(x) - mu) / sigma) ^ 2) / (x * sqrt(2 * pi) * sigma)
method <- 'fit'
cf <- function(t) cfX_PDF(t, pdfFun, method)
options <- list()
options$xMin <- 0
result <- cf2DistGP(cf = cf, options = options)
## EXAMPLE4 (CF of the Weibull distribution with a = 1.5, and small b<1)
a <- 1.5
b <- 0.5
pdfFun <- function(x) (x / a) ^ (b - 1) * exp(-((x / a) ^ b)) * b / a
method <- 'fit'
t <- seq(from = -20, to = 20, length.out = 2^10+1)
plotReIm(function(t) cfX_PDF(t, pdfFun, method), t,
'Characteristic function of the Weibull distribution')
## EXAMPLE5 (CF of the Weibull distribution with a = 1.5, and large b > 1)
a <- 1.5
b <- 3.5
pdfFun <- function(x) (x / a) ^ (b - 1) * exp(-((x / a) ^ b)) * b / a
method <- 'def'
t <- seq(from = -10, to = 10, length.out = 2^10+1)
plotReIm(function(t) cfX_PDF(t, pdfFun, method), t,
'Characteristic function of the Weibull distribution')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.