lloi: The Log-Type I Logistic Distribution

View source: R/01_bcloi.R

lloiR Documentation

The Log-Type I Logistic Distribution

Description

Density, distribution function, quantile function, and random generation for the log-type I logistic distribution with parameters mu and sigma.

Usage

dlloi(x, mu, sigma, log = FALSE, ...)

plloi(q, mu, sigma, lower.tail = TRUE, ...)

qlloi(p, mu, sigma, lower.tail = TRUE, ...)

rlloi(n, mu, sigma)

Arguments

x, q

vector of positive quantiles.

mu

vector of strictly positive scale parameters.

sigma

vector of strictly positive relative dispersion parameters.

log

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

...

further arguments.

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.

Details

A random variable X has a log-type I logistic distribution with parameter mu and sigma if log(X) follows a type I logistic distribution with location parameter log(mu) and dispersion parameter sigma. It can be showed that mu is the median of X.

Value

dlloi returns the density, plloi gives the distribution function, qlloi gives the quantile function, and rlloi generates random observations.

Invalid arguments will result in return value NaN.

The length of the result is determined by n for rlloi, 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

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.

Examples

mu <- 5
sigma <- 1

# Sample generation
x <- rlloi(1000, mu, sigma)

# Density
hist(x, prob = TRUE, main = "The Log-Type I Logistic Distribution", col = "white")
curve(dlloi(x, mu, sigma), add = TRUE, col = 2, lwd = 2)
legend("topright", "Probability density function", col = 2, lwd = 2, lty = 1)

# Distribution function
plot(ecdf(x), main = "The Log-Type I Logistic Distribution", ylab = "Distribution function")
curve(plloi(x, mu, sigma), add = TRUE, col = 2, lwd = 2)
legend("bottomright", 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 Log-Type I Logistic Distribution"
)
curve(qlloi(x, mu, sigma), 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.