Learn R Programming

CharFun (version 0.1.0)

cfX_ChiSquared: Characteristic function of Noncentral Chi-Squared distribution

Description

cfX_ChiSquared(t, df, ncp = 0) evaluates the characteristic function cf(t) of the Chi-Squared distribution with the parameter df (degrees of freedom, df > 0) and npc (non-centrality, \(npc \ge 0\)), i.e.

cfX_ChiSquared(t, df, npc) = exp((i*npc*t)/(1 - 2it)) / (1 - 2it)^(df/2)

Usage

cfX_ChiSquared(t, df, npc = 0)

Arguments

t
numerical values (number, vector...)
df
degrees of freedom
npc
non-centrality parameter, default value = 0

Value

characteristic function cf(t) of the CHI-SUQARED distribution

See Also

For more details see WIKIPEDIA: https://en.wikipedia.org/wiki/Noncentral_chi-squared_distribution

Other Continuous Probability distribution: cfS_Arcsine, cfS_Beta, cfS_Gaussian, cfS_Rectangular, cfS_StudentT, cfS_Trapezoidal, cfS_Triangular, cfX_Beta, cfX_Exponential, cfX_Gamma, cfX_InverseGamma, cfX_LogNormal, cfX_Normal, cfX_PearsonV, cfX_Rectangular, cfX_Triangular

Examples

Run this code
## EXAMPLE1 (CF of the ChiSquared distribution with df = 1)
df <- 1
t <- seq(-50, 50, length.out = 501)
plotGraf(function(t)
  cfX_ChiSquared(t, df), t, title = "CF of the Chi-squared distribution with df = 1")

## EXAMPLE2 (PDF/CDF of the ChiSquared distribution with df = 3)
df <- 3
prob <- c(0.9, 0.95, 0.99)
cf <- function(t)
  cfX_ChiSquared(t, df)
x <- seq(-0, 15, length.out = 101)
result <- cf2DistGP(cf,
                    x,
                    prob,
                    xMin = 0,
                    xMax = 22,
                    N = 2 ^ 14)

## EXAMPLE3 (PDF/CDF of the compound Binomial-ChiSquared distribution)
n <- 25
p <- 0.3
df <- 3
prob <- c(0.9, 0.95, 0.99)
cfX <- function(t)
  cfX_ChiSquared(t, df)
cf <- function(t)
  cfN_Binomial(t, n, p, cfX)
x <- seq(-0, 80, length.out = 501)
result <- cf2DistGP(cf, x, prob, isCompound = TRUE)

## EXAMPLE4 (CF of the ChiSquared distribution with df = 1, npc = 2)
df <- 1
npc <- 2
t <- seq(-50, 50, length.out = 501)
plotGraf(function(t)
  cfX_ChiSquared(t, df, npc), t, title = "CF of the Chi-squared distribution with df = 1, npc = 2")

## EXAMPLE5 (PDF/CDF of the ChiSquared distribution with df = 3, npc = 2)
df <- 3
npc <- 2
prob <- c(0.9, 0.95, 0.99)
cf <- function(t)
  cfX_ChiSquared(t, df, npc)
x <- seq(-0, 15, length.out = 101)
result <- cf2DistGP(cf, x, prob, N = 2 ^ 14)

## EXAMPLE6 (PDF/CDF of the compound Binomial-ChiSquared distribution)
n <- 25
p <- 0.3
df <- 3
npc <- 2
prob <- c(0.9, 0.95, 0.99)
cfX <- function(t)
  cfX_ChiSquared(t, df, npc)
cf <- function(t)
  cfN_Binomial(t, n, p, cfX)
x <- seq(-0, 80, length.out = 501)
result <- cf2DistGP(cf, x, prob, isCompound = TRUE)

Run the code above in your browser using DataLab