dctp: CTP distribution

View source: R/distributions.R

dctpR Documentation

CTP distribution

Description

Density, distribution, quantile and random-generation functions for the complex triparametric Pearson distribution.

Usage

dctp(x, a, b, gama, log = FALSE)

pctp(q, a, b, gama, lower.tail = TRUE, log.p = FALSE)

qctp(
  p,
  a,
  b,
  gama,
  lower.tail = TRUE,
  log.p = FALSE,
  max_q = 1000,
  max_count = 1000000L
)

rctp(n, a, b, gama)

Arguments

x

Numeric vector of counts. Nonintegers and negative values have probability zero; missing values propagate.

a, b, gama

Finite scalar parent parameters, with b >= 0 and gama > max(0, 2*a). The spelling gama is retained.

log

Return log probabilities.

q

Numeric vector of quantiles; values are rounded down.

lower.tail

Return P(X \le q) if true and P(X > q) otherwise.

log.p

Probabilities are on the log scale.

p

Numeric vector of probabilities. Missing values propagate.

max_q

Initial search endpoint, retained for compatibility. It is expanded as needed, rather than returned as a capped quantile.

max_count

Maximum search endpoint, at most 1,000,000. Failure to bracket a requested quantile raises an error.

n

Number of draws, a nonnegative integer.

Details

The probability at zero is evaluated from a shifted log-gamma expansion. Subsequent log probabilities use the recurrence

p(k+1)/p(k) = ((a+k)^2+b^2)/((gama+k)(k+1)).

Probabilities are not renormalised on the requested support. Moment existence is checked by moment functions, not by density functions. Recurrences have a work limit of 1,000,000 counts and signal an error when that limit is insufficient. At b = 0, nonpositive integer a gives a terminating distribution.

Value

Numeric vector of probabilities, cumulative probabilities, quantiles, or integer random draws. Quantiles return Inf at probability one for an infinite-support distribution.

Examples

dctp(0:5, 1, 0.5, 6)
pctp(c(-Inf, 0, 2, Inf), 1, 0.5, 6)
qctp(c(0, 0.5, 0.99, 1), 1, 0.5, 6)
set.seed(123)
rctp(10, 1, 0.5, 6)

zmctp documentation built on Oct. 30, 2026, 1:07 a.m.