R/Examples/example_cfN_Binomial.R

Defines functions cf cfX cfX

## EXAMPLE1
# CF of the Binomial distribution with n = 25, p = 0.3
n <- 25
p <- 0.3
t <- seq(-15, 15, length.out = 1001)
plotReIm(function(t)
        cfN_Binomial(t, n, p),
        t,
        title = "CF of the Binomial distribution with n = 25, p = 0.3")

## EXAMPLE2
# CF of the compound Binomial-Exponential distribution
n <- 25
p <- 0.3
lambda <- 10
cfX <- function(t)
        cfX_Exponential(t, lambda)
t <- seq(-10, 10, length.out = 501)
plotReIm(function(t)
        cfN_Binomial(t, n, p, cfX),
        t,
        title = "CF of the compound Binomial-Exponential distribution")

## EXAMPLE3
# PDF/CDF of the compound Binomial-Exponential distribution
n <- 25
p <- 0.3
lambda <- 5
cfX <- function(t)
        cfX_Exponential(t, lambda)
cf <- function(t)
        cfN_Binomial(t, n, p, cfX)
x <- seq(0, 5, length.out = 101)
prob <- c(0.9, 0.95, 0.99)
options <- list()
options$isCompound <- TRUE
result <- cf2DistGP(cf, x, prob, options)
gajdosandrej/CharFunToolR documentation built on June 3, 2024, 7:46 p.m.