ApproxCDF: Numerical Approximation of characteristic function

Description Usage Arguments Examples

View source: R/ApproximateCharFun.R

Description

ApproxCDF approximates the cdf F when given a characteristic function phi of a centered random variable, using the formula found in Waller (1995) with original reference to Bohman (1974). The procedure can be numerically unstable in the tails of the distribution, so only the center of the approximation is returned. Some simplifying approximations explained in "Numerical inversion of laplace transform and characteristic function" are used. Note that phi should have a finite first moment.

Usage

1
ApproxCDF(phi, H = 2000, eta = 0.5, xlim = NULL, smoothe = FALSE)

Arguments

phi

the characteristic function to be inverted

H

A total of 2H+1 values of F are approximated. By default H of these values are returned unless an interval is provided.

eta

A scaling paramter. By default equidistant points in the interval (-2*phi/eta,2*phi/(eta)) are approximated.

xlim

(optional) limits on the x-axis

smoothe

(optional) Should smoothing be used? If TRUE default weights of the function simple_smoothe are used. If an object of length > 1 is provided, this will be passed to simple_smoothe

Examples

1
2
3
4
5
6
7
8
9
phi <- function(t) exp(-t^2/2)
appvals=ApproxCDF(phi,H=1000,eta=0.5,xlim=c(-3,3))
plot(appvals[[1]],appvals[[2]],type="l",lwd=2)
lines(appvals[[1]],pnorm(appvals[[1]]),type="l",col="red")

phi <- function(t) sqrt(2)*abs(t)*besselK(sqrt(2)*abs(t),1)
appvals=ApproxCDF(phi,H=10000,eta=0.1,xlim=c(-3,3))
plot(appvals[[1]],appvals[[2]],type="l",lwd=2)
lines(appvals[[1]],pt(appvals[[1]],df=2),type="l",col="red")

rivasiker/phasty documentation built on June 15, 2021, 9:18 p.m.