LW: The Log-Weibull Distribution

Description Usage Arguments Details Value Examples

Description

Density, distribution function, quantile function, random generation and hazard function for the log-weibull distribution with parameters a and b.

Usage

1
2
3
4
5
6
7
8
9
dLW(x, a, b, log = FALSE)

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

qLW(p, a, b, lower.tail = TRUE, log.p = FALSE)

rLW(n, a, b)

hLW(x, a, b)

Arguments

x,q

vector of quantiles.

a

parameter one.

b

parameter two.

log,log.p

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 observations.

Details

The log-weibull distribution with parameters a and b has density given by

f(x)= (1/b)*exp((x-a)/b)*exp(-exp((x-a)/b))

for -Inf < x < Inf.

Value

dLW gives the density, pLW gives the distribution function, qLW gives the quantile function, rLW generates random deviates and hLW gives the hazard function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## The probability density function
curve(dLW(x, a = 0, b = 1), from = -20, to = 10, ylim = c(0, 0.4), col = "red", las = 1, ylab = "The probability density function")

## The cumulative distribution and the Reliability function
par(mfrow = c(1, 2))
curve(pLW(x, a = 0, b = 1), from = 0, to = 10, ylim = c(0, 1), col = "red", las = 1, ylab = "The cumulative distribution function")
curve(pLW(x, a = 0, b = 1, lower.tail = FALSE), from = 0, to = 10, ylim = c(0, 1), col = "red", las = 1, ylab = "The Reliability function")

## The quantile function
p <- seq(from = 0, to = 0.998, length.out = 100)
plot(x=qLW(p, a = 0, b = 1), y = p, xlab = "Quantile", las = 1, ylab = "Probability")
curve(pLW(x, a = 0, b = 1), from = -6, add = TRUE, col = "red")

## The random function
hist(rLW(10000, a = 0, b = 1), freq = FALSE,  ylim = c(0, 0.4), xlab = "x", las = 1, main = "")
curve(dLW(x, a = 0, b = 1),  from = -20, to = 10,  ylim = c(0, 0.4), add = TRUE, col = "red")

## The Hazard function
curve(hLW(x, a = 0, b = 1), from = -20, to = 0, ylim = c(0, 0.3), col = "red", ylab = "The hazard function", las = 1)

ousuga/reldist documentation built on May 24, 2019, 5:54 p.m.