cf_InverseGamma: Characteristic function of a linear combination of...

View source: R/cf_InverseGamma.R

cf_InverseGammaR Documentation

Characteristic function of a linear combination of independent INVERSE-GAMMA random variables

Description

cf_InverseGamma(t, alpha, beta, coef, niid) evaluates the characteristic function cf(t) of a linear combination (resp. convolution) of independent INVERSE-GAMMA random variables.

That is, cf_InvGamma evaluates the characteristic function cf(t) of Y = sum_{i=1}^N coef_i * X_i, where X_i ~ InvGamma(\alpha_i,\beta_i) are inedependent RVs, with the shape parameters \alpha_i > 0 and the rate parameters \beta_i > 0, for i = 1,...,N.

The characteristic function of Y is defined by

cf(t) = Prod( 2 / gamma(\alpha(i)) * (-1i*\beta(i)*t).^(\alpha(i)/2) * besselk(\alpha(i),sqrt(-4i*\beta(i)*t)) ).

Usage

cf_InverseGamma(t, alpha, beta, coef, niid)

Arguments

t

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

alpha

the shape parameter alpha > 0. If empty, default value is alpha = 1.

beta

the rate (1/scale) parameter beta > 0. If empty, default value is beta = 1.

coef

- vector of the coefficients of the linear combination of the IGamma random variables. If coef is scalar, it is assumed that all coefficients are equal. If empty, default value is coef = 1.

niid

scalar convolution coeficient niid, such that Z = Y +...+ Y is sum of niid iid random variables Y, where each Y = sum_{i=1}^N coef_i * X_i is independently and identically distributed random variable. If empty, default value is niid = 1.

Details

PARAMETRIZATION:
As for the GAMMA distribution, also for the Inverse-Gamma distribution there are three different possible parametrizations:
i) With a shape parameter k and a scale parameter \theta.
ii) With a shape parameter \alpha = k and an inverse scale parameter \beta = 1/\theta, called a rate parameter.
iii) With a shape parameter k and a mean parameter \mu = k/\beta. In each of these three forms, both parameters are positive real numbers.

Here, cf_InverseGamma implements the shape-rate parametrization with parameters \alpha and \beta, respectively.

If X ~ IGamma(df/2,1/2)(shape-rate parametrization), then X is identical to ICHI2(df), the Inverse-Chi-squared distribution with df degrees of freedom.

Value

Characteristic function cf(t) of a linear combination of independent INVERSE-GAMMA random variables.

Note

Ver.: 16-Sep-2018 18:28:11 (consistent with Matlab CharFunTool v1.3.0, 10-May-2017 18:11:50).

References

WITKOVSKY, V.: Computing the distribution of a linear combination of inverted gamma variables, Kybernetika 37 (2001), 79-90.

See Also

For more details see WIKIPEDIA: https://en.wikipedia.org/wiki/Inverse-gamma_distribution.

Other Continuous Probability Distribution: cfS_Arcsine(), cfS_Beta(), cfS_Gaussian(), cfS_Laplace(), cfS_Rectangular(), cfS_Student(), cfS_TSP(), cfS_Trapezoidal(), cfS_Triangular(), cfS_Wigner(), cfX_ChiSquare(), cfX_Exponential(), cfX_FisherSnedecor(), cfX_Gamma(), cfX_InverseGamma(), cfX_LogNormal(), cf_ArcsineSymmetric(), cf_BetaNC(), cf_BetaSymmetric(), cf_Beta(), cf_ChiSquare(), cf_Exponential(), cf_FisherSnedecorNC(), cf_FisherSnedecor(), cf_Gamma(), cf_Laplace(), cf_LogRV_BetaNC(), cf_LogRV_Beta(), cf_LogRV_ChiSquareNC(), cf_LogRV_ChiSquare(), cf_LogRV_FisherSnedecorNC(), cf_LogRV_FisherSnedecor(), cf_LogRV_MeansRatioW(), cf_LogRV_MeansRatio(), cf_LogRV_WilksLambdaNC(), cf_LogRV_WilksLambda(), cf_Normal(), cf_RectangularSymmetric(), cf_Student(), cf_TSPSymmetric(), cf_TrapezoidalSymmetric(), cf_TriangularSymmetric(), cf_vonMises()

Examples

## EXAMPLE 1
# CF of a linear combination of K=100 independent IGamma RVs
coef <- 1 / (((1:50) - 0.5) * pi) ^ 2
plot(
        1:50,
        coef,
        xlab = "",
        ylab = "",
        type = "p",
        pch = 20,
        col = "blue",
        cex = 1,
        main = expression('Coefficients of the linear combination of' ~ chi ^ 2 ~ 'RVs with DF=1')
)
lines(1:50, coef, col = "blue")
alpha <- 5 / 2
beta <- 2
t <- seq(from = -100,
         to = 100,
         length.out = 201)
plotReIm(function(t)
        cf_InverseGamma(t, alpha, beta, coef), t,
        title = "Characteristic function of the linear combination of IGamma RVs")

## EXAMPLE 2
# PDF/CDF from the CF by cf2DistGP
alpha <- 5 / 2
beta <- 1 / 2
coef <- 1 / (((1:50) - 0.5) * pi) ^ 2
cf <- function(t)
        cf_InverseGamma(t, alpha, beta, coef)
options <- list()
options$N <- 2 ^ 10
options$xMin = 0
x <- seq(from = 0,
         to = 4,
         length.out = 201)
prob <- c(0.9, 0.95, 0.99)
result <- cf2DistGP(cf, x, prob, options)
result

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