bct: The Box-Cox t Distribution

View source: R/01_bct.R

bctR Documentation

The Box-Cox t Distribution

Description

Density, distribution function, quantile function, and random generation for the Box-Cox t distribution with parameters mu, sigma, lambda, and nu.

Usage

dbct(x, mu, sigma, lambda, nu, log = FALSE)

pbct(q, mu, sigma, lambda, nu, lower.tail = TRUE)

qbct(p, mu, sigma, lambda, nu, lower.tail = TRUE)

rbct(n, mu, sigma, lambda, nu)

Arguments

x, q

vector of positive quantiles.

mu

vector of strictly positive scale parameters.

sigma

vector of strictly positive relative dispersion parameters.

lambda

vector of real-valued skewness parameters. If lambda = 0, the Box-Cox t distribution reduces to the log-t distribution with parameters mu, sigma, and nu (see lt).

nu

strictly positive heavy-tailedness parameter.

log

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].

p

vector of probabilities.

n

number of random values to return.

Value

dbct returns the density, pbct gives the distribution function, qbct gives the quantile function, and rbct generates random observations.

Invalid arguments will result in return value NaN, with an warning.

The length of the result is determined by n for rbct, and is the maximum of the lengths of the numerical arguments for the other functions.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@live.com>

References

Rigby, R. A., Stasinopoulos, D.M. (2006). Using the Box-Cox t distribution in GAMLSS to model skewness and kurtosis. Statistical Model, 6, 209-229

Vanegas, L. H., and Paula, G. A. (2016). Log-symmetric distributions: statistical properties and parameter estimation. Brazilian Journal of Probability and Statistics, 30, 196-220.

Ferrari, S. L. P., and Fumes, G. (2017). Box-Cox symmetric distributions and applications to nutritional data. AStA Advances in Statistical Analysis, 101, 321-344.

Examples

mu <- 8
sigma <- 1
lambda <- 2
nu <- 4

# Sample generation
x <- rbct(10000, mu, sigma, lambda, nu)

# Density
hist(x, prob = TRUE, main = "The Box-Cox t Distribution", col = "white")
curve(dbct(x, mu, sigma, lambda, nu), add = TRUE, col = 2, lwd = 2)
legend("topleft", "Probability density function", col = 2, lwd = 2, lty = 1)

# Distribution function
plot(ecdf(x), main = "The Box-Cox t Distribution", ylab = "Distribution function")
curve(pbct(x, mu, sigma, lambda, nu), add = TRUE, col = 2, lwd = 2)
legend("topleft", c("Emp. distribution function", "Theo. distribution function"),
  col = c(1, 2), lwd = 2, lty = c(1, 1)
)

# Quantile function
plot(seq(0.01, 0.99, 0.001), quantile(x, seq(0.01, 0.99, 0.001)),
  type = "l",
  xlab = "p", ylab = "Quantile function", main = "The Box-Cox t Distribution"
)
curve(qbct(x, mu, sigma, lambda, nu), add = TRUE, col = 2, lwd = 2, from = 0, to = 1)
legend("topleft", c("Emp. quantile function", "Theo. quantile function"),
  col = c(1, 2), lwd = 2, lty = c(1, 1)
)

rdmatheus/BCNSM documentation built on Feb. 8, 2024, 1:28 a.m.