Learn R Programming

skewunit (version 1.0)

Uquad: The U-quadratic distribution

Description

Density, distribution function and random generation for the U-quadratic distribution.

Usage

dUquad(x, a=0, b=1, log=FALSE)
pUquad(q, a=0, b=1, lower.tail=TRUE, log.p=FALSE)
rUquad(n, a=0, b=1)

Value

dUquad gives the density, pUquad gives the distribution function, and rUquad generates random deviates. The length of the result is determined by n for rasin, and is the maximum of the lengths of the numerical arguments for the other functions. The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.

Arguments

x, q

vector of quantiles.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

a, b

range of variable x. (\(a<b\)).

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE (default), probabilities are \(P[X\leq x]\), otherwise, \(P[X>x]\).

Author

Diego Gallardo

Details

The U-quadratic distribution has density $$ f(x) = \alpha (x-\beta)^2, \quad x\in (a,b), a\leq x \leq b, $$ where \(\alpha=12/(b-a)^3\) and \(\beta=(a+b)/2\). Its cumulative distribution function is $$ F(x) = \frac{\alpha}{3}[(x-\beta)^3+(\beta-a)^3], \quad x\in (a,b). $$

Examples

Run this code
dUquad(0.5)
pUquad(0.5)
rUquad(5)

Run the code above in your browser using DataLab