# cf_Normal: Characteristic function of a linear combination of... In gajdosandrej/CharFunToolR: Numerical Computation Cumulative Distribution Function and Probability Density Function from Characteristic Function

 cf_Normal R Documentation

## Characteristic function of a linear combination of independent NORMAL random variables.

### Description

cf_Normal(t, mu, sigma, coef, niid) evaluates the characteristic function cf(t) of a linear combination (resp. convolution) of independent NORMAL random variables.

That is, cf_Normal evaluates the characteristic function cf(t) of Y = sum_{i=1}^N coef_i * X_i, where X_i ~ N(\mu_i,\sigma_i) are inedependent RVs, with means \mu_i and standard deviations \sigma_i > 0, for i = 1,...,N.

The characteristic function of Y is defined by

cf(t) = exp(1i*(coef'*\mu)*t - (1/2)*(coef^2'*\sigma^2)*t^2).

### Usage

cf_Normal(t, mu, sigma, coef, niid)


### Arguments

 t vector or array of real values, where the CF is evaluated. mu vector of the 'location' parameters mu in R. If empty, default value is mu = 0. sigma vector of the 'scale' parameters sigma > 0. If empty, default value is sigma = 1. coef vector of the coefficients of the linear combination of the Normal 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 NORMAL random variables.

### Note

The characteristic function of a lienar combination of independent Normal random variables has well known exact form.

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

For more details see WIKIPEDIA: https://en.wikipedia.org/wiki/Normal_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_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_RectangularSymmetric(), cf_Student(), cf_TSPSymmetric(), cf_TrapezoidalSymmetric(), cf_TriangularSymmetric(), cf_vonMises()

### Examples

## EXAMPLE 1
# CF of a linear combination of K=100 independent Norma 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")
mu <- seq(from = -3,
to = 3,
length.out = 50)
sigma <- seq(from = 0.1,
to = 1.5,
length.out = 50)
t <- seq(from = -100,
to = 100,
length.out = 2001)
plotReIm(function(t)
cf_Normal(t, mu, sigma, coef),
t,
title = "Characteristic function of the linear combination of Normal RVs")

## EXAMPLE 2
# PDF/CDF from the CF by cf2DistGP
mu <- seq(from = -3,
to = 3,
length.out = 50)
sigma <- seq(from = 0.1,
to = 1.5,
length.out = 50)
coef <- 1 / (((1:50) - 0.5) * pi) ^ 2
cf <- function(t)
cf_Normal(t, mu, sigma, coef)
options <- list()
options$N <- 2 ^ 10 options$SixSigmaRule <- 8
prob <- c(0.01, 0.05, 0.1, 0.5, 0.9, 0.950, 0.99)
result <- cf2DistGP(cf = cf, prob = prob, options = options)
result


gajdosandrej/CharFunToolR documentation built on Aug. 22, 2023, 9:58 a.m.