weibull3p: Weibull Distribution with Three Parameters

weibull3pR Documentation

Weibull Distribution with Three Parameters

Description

Probability density function (PDF), cummulative density function (CDF), quantile function and random generation for the Three-Parameter Weibull (weibull3p) distribution.

Usage

dweibull3p(x, shape = 1, scale = 1, mu = 0, log = FALSE)

pweibull3p(q, shape = 1, scale = 1, mu = 0, lower.tail = TRUE, log.p = FALSE)

qweibull3p(p, shape = 1, scale = 1, mu = 0, lower.tail = TRUE, log.p = FALSE)

rweibull3p(n, shape = 1, scale = 1, mu = 0)

Arguments

x, q

numeric vector

shape

shape parameter, or slope, defaulting to 1

scale

scale parameter, or characteristic life, defaulting to 1

mu

location parameter (numerical, default 0).

lower.tail

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

log.p

logical; if TRUE, probabilities/densities p are returned as log(p).

n

number of observations

Details

It is important to mention that Weibull distribution is defined for x > 0 and, therefore, values x < 0 will yield probability zero. While to obtain negative random values with function rweibull3p is an indication that the location parameter \mu has not a valid value.

Value

Three-parameter PDF values for dweibull3p, three-parameter probability for pweibull3p, quantiles or three-parameter random generated values for rweibull3p.

Examples

set.seed(123) # set a seed for random generation
##  Sampling from the specified Weibull distribution
r <- rweibull3p(n = 1e5, shape = 1.4, scale = 3.7, mu = 0.9)

## The histogram and density
hist(r, 100, freq = FALSE, xlim = c(0, 20))
r1 <- seq(0, 20, by = 0.1)
lines(r1, dweibull3p(r1, shape = 1.4, scale = 3.7, mu = 0.9),
    col = "red"
)


genomaths/usefr documentation built on April 18, 2023, 3:35 a.m.