RW: The Reflected Weibull Distribution

Description Usage Arguments Details Value Examples

Description

Density, distribution function, quantile function, random generation and hazard function for the reflected weibull distribution with parameters alpha and theta.

Usage

1
2
3
4
5
6
7
8
9
dRW(x, alpha, theta, log = FALSE)

pRW(q, alpha, theta, lower.tail = TRUE, log.p = FALSE)

qRW(p, alpha, theta, lower.tail = TRUE, log.p = FALSE)

rRW(n, alpha, theta)

hRW(x, alpha, theta)

Arguments

x,q

vector of quantiles.

alpha

parameter one.

theta

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 reflected weibull distribution with parameters alpha and theta has density given by

f(x) = alpha*theta*(-x)^(theta-1)*exp(-alpha*(-x)^alpha)

for - inf < x < 0.

Value

dRW gives the density, pRW gives the distribution function, qRW gives the quantile function, rRW generates random deviates and hRW 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(dRW(x, alpha = 1, theta = 1), from = -5, to = 0, ylim = c(0, 1), col = "red", las = 1, ylab = "The probability density function")

## The cumulative distribution and the Reliability function
par(mfrow = c(1, 2))
curve(pRW(x, alpha = 1, theta = 1), from = -5, to = 0, ylim = c(0, 1), col = "red", las = 1, ylab ="The cumulative distribution function")
curve(pRW(x, alpha = 1, theta = 1, lower.tail = FALSE), from = -5, to = 0, 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=qRW(p=p,alpha = 1, theta = 1), y=p, xlab="Quantile", las=1, ylab="Probability")
curve(pRW(x, alpha = 1, theta = 1), from = -5, add = TRUE, col = "red")

## The random function
hist(rRW(n = 10000, alpha = 1, theta = 1), freq = FALSE,xlab = "x", las = 1, main = "")
curve(dRW(x, alpha = 1, theta = 1),  from = -5, to = 0, add = TRUE, col = "red")

## The Hazard function
curve(hRW(x, alpha = 1, theta = 1), from = -5, to = 0, ylim = c(0, 1), col = "red", ylab = "The hazard function", las = 1)

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