Learn R Programming

extraDistr (version 1.8.1)

PowerDist: Power distribution

Description

Density, distribution function, quantile function and random generation for the power distribution.

Usage

dpower(x, alpha, beta, log = FALSE)
ppower(q, alpha, beta, lower.tail = TRUE, log.p = FALSE)
qpower(p, alpha, beta, lower.tail = TRUE, log.p = FALSE)
rpower(n, alpha, beta)

Arguments

x, q
vector of quantiles.
alpha, beta
parameters.
log, log.p
logical; if TRUE, probabilities p are given as log(p).
lower.tail
logical; if TRUE (default), probabilities are $P[X \le x]$ otherwise, $P[X > x]$.
p
vector of probabilities.
n
number of observations. If length(n) > 1, the length is taken to be the number required.

Details

Probability density function $$ f(x) = \frac{\beta x^{\beta-1}}{\alpha^\beta} $$

Cumulative distribution function $$ F(x) = \frac{x^\beta}{\alpha^\beta} $$

Quantile function $$ F^{-1}(p) = \alpha p^{1/\beta} $$

Examples

Run this code

x <- rpower(1e5, 5, 16)
xx <- seq(-100, 100, by = 0.001)
hist(x, 100, freq = FALSE)
lines(xx, dpower(xx, 5, 16), col = "red")
hist(ppower(x, 5, 16))
plot(ecdf(x))
lines(xx, ppower(xx, 5, 16), col = "red", lwd = 2)

Run the code above in your browser using DataLab