R/Examples/example_cfN_NegativeBinomial.R

Defines functions cf cfX

## EXAMPLE1
# CF of the Negative Binomial distribution with r = 5, p = 0.3
r <- 5
p <- 0.3
t <- seq(-15, 15, length.out = 1001)
plotReIm(function(t)
        cfN_NegativeBinomial(t, r, p), t,
        title = "CF of the Negative Binomial distribution with r = 5, p = 0.3")

## EXAMPLE2
# PDF/CDF of the compound NegativeBinomial-Exponential distribution
r <- 5
p <- 0.3
lambda <- 5
cfX <- function(t)
        cfX_Exponential(t, lambda)
cf <- function(t)
        cfN_NegativeBinomial(t, r, p, cfX)
x <- seq(0, 10, 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.