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

View source: R/cf_ChiSquare.R

cf_ChiSquareR Documentation

Characteristic function of a linear combination of independent CHI-SQUARE random variables

Description

cf_ChiSquare(t, df, ncp, coef, niid) evaluates the characteristic function cf(t) of a linear combination (resp.convolution) of independent (possibly non-central) CHI-SQUARE random variables.

That is, cf_ChiSquare evaluates the characteristic function cf(t) of Y = sum_{i=1}^N coef_i * X_i, where X_i ~ ChiSquare(df_i,ncp_i) are inedependent RVs, with df_i > 0 degrees of freedom the 'non-centrality' parameters ncp_i > 0, for i = 1,...,N.

The characteristic function of Y is defined by

cf(t) = Prod ( (1-2*i*t*coef(i))^(-df(i)/2) * exp((i*t*ncp(i))/(1-2*i*t*coef(i))) ).

Usage

cf_ChiSquare(t, df, ncp, coef, niid)

Arguments

t

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

df

the degrees of freedom parameter df > 0. If empty, default value is df = 1.

ncp

the non-centrality parameter ncp > 0. If empty, default value is ncp = 0.

coef

vector of the coefficients of the linear combination of the chi-squared 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) * log(X_i) is independently and identically distributed random variable. If empty, default value is niid = 1.

Value

Characteristic function cf(t) of a linear combination of independent CHI-SQUARE random variables.

Note

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

References

IMHOF J. (1961): Computing the distribution of quadratic forms in normal variables. Biometrika 48, 419-426.

See Also

For more details see WIKIPEDIA: https://en.wikipedia.org/wiki/Chi-squared_distribution,
https://en.wikipedia.org/wiki/Noncentral_chi-squared_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_Exponential(), cf_FisherSnedecorNC(), cf_FisherSnedecor(), cf_Gamma(), cf_InverseGamma(), 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 the distribution of ChiSquare RV with DF = 1, NCP = 1
df <- 1
ncp <- 1
coef <- 1
t <- seq(from = -100,
         to = 100,
         length.out = 501)
plotReIm(
        function(t)
                cf_ChiSquare(t, df, ncp, coef),
        t,
        title = expression('Characteristic function of the' ~ chi ^ 2 ~ 'RV with DF=1 and NCP=1')
)

## EXAMPLE 2
# CF of a linear combination of K=100 independent ChiSquare 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")
df <- 1
t <- seq(from = -100,
         to = 100,
         length.out = 501)
plotReIm(
        function(t)
                cf_ChiSquare(t = t, df = df, coef = coef),
        t,
        title = expression('CF of the linear combination of' ~ chi ^ 2 ~ 'RVs with DF=1')
)

## EXAMPLE 3
# PDF/CDF from the CF by cf2DistGP
df <- 1
coef <-  1 / (((1:50) - 0.5) * pi) ^ 2
cf <- function(t)
        cf_ChiSquare(t = t, df = df, coef = coef)
options <- list()
options$N <- 2 ^ 12
options$xMin <- 0
x <- seq(from = 0,
         to = 3.5,
         length.out = 501)
prob <- c(0.9, 0.95, 0.975, 0.99)
result <- cf2DistGP(cf, x, prob, options)
result

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