WG: The Weibull Geometric Distribution

Description Usage Arguments Details Value Examples

Description

Density, distribution function, quantile function, random generation and hazard function for the weibull geometric distribution with parameters alpha, beta and pi.

Usage

1
2
3
4
5
6
7
8
9
dWG(x, alpha, beta, pi, log = FALSE)

pWG(q, alpha, beta, pi, lower.tail = TRUE, log.p = FALSE)

qWG(p, alpha, beta, pi, lower.tail = TRUE, log.p = FALSE)

rWG(n, alpha, beta, pi)

hWG(x, alpha, beta, pi)

Arguments

x,q

vector of quantiles.

alpha

shape parameter.

beta

scale parameter.

pi

parameter of geometric random variable.

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 weibull geometric distribution with parameters alpha, beta and pi has density given by

f(x) = (alpha*(beta)^alpha*(1-pi)*x^(alpha-1)*exp(-(beta*x)^alpha))/(1- pi*exp(-(beta*x)^alpha))^2

for x > 0.

Value

dWG gives the density, pWG gives the distribution function, qWG gives the quantile function, rWG generates random deviates and hWG 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(dWG(x, alpha = 0.5, beta = 0.2, pi = 0.95), from = 0, to = 5, ylim = c(0, 1.5), col = "red", las = 1, ylab = "The probability density function")

## The cumulative distribution and the Reliability function
par(mfrow = c(1, 2))
curve(pWG(x, alpha = 0.5, beta = 0.2, pi = 0.95), from = 0, to = 5, ylim = c(0, 1), col = "red", las = 1, ylab = "The cumulative distribution function")
curve(pWG(x, alpha = 0.5, beta = 0.2, pi = 0.95, lower.tail = FALSE), from = 0, to = 5, ylim = c(0, 1), col = "red", las = 1, ylab = "The Reliability function")

## The quantile function
p <- seq(from = 0, to = 0.99999, length.out = 100)
plot(x = qWG(p = p, alpha = 0.5, beta = 0.2, pi = 0.95), y = p, xlab = "Quantile", las = 1, ylab = "Probability")
curve(pWG(x, alpha = 0.5, beta = 0.2, pi = 0.95), from = 0, add = TRUE, col = "red")

## The random function
hist(rWG(1000, alpha = 0.5, beta = 0.2, pi = 0.95), freq = FALSE, xlab = "x", ylim = c(0, 0.2), las = 1, main = "")
curve(dWG(x, alpha = 0.5, beta = 0.2, pi = 0.95),  from = 0, add = TRUE, col = "red", ylim = c(0, 0.2))

## The Hazard function
curve(hWG(x, alpha = 0.5, beta = 0.2, pi = 0.95), from = 0, to = 15, ylim = c(0, 2.2), col = "red", ylab = "The hazard function", las = 1)

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