dcusp {cusp} | R Documentation |
Cobb's Cusp Distribution
Description
Functions for the cusp distribution.
Usage
dcusp(y, alpha, beta)
pcusp(y, alpha, beta, subdivisions = 100, rel.tol = .Machine$double.eps^0.25,
abs.tol = rel.tol, stop.on.error = TRUE, aux = NULL, keep.order = TRUE)
qcusp(p, alpha, beta)
rcusp(n, alpha, beta)
Arguments
y |
vector of quantiles |
p |
vector of probabilities |
n |
number of observations. |
alpha |
normal/asymmetry factor value of cusp density |
beta |
bifurcation/splitting factor value of cusp density |
subdivisions |
See |
rel.tol |
See |
abs.tol |
See |
stop.on.error |
See |
aux |
See |
keep.order |
logical. If true the order of the output values is the same as those of the input values |
Details
The cusp distribution is defined by
f(y) = \Psi \exp(\alpha y + \beta y^2/2 - y^4/4),
where \Psi
is the normalizing constant.
rcusp
uses rejection sampling to generate samples.
qcusp
implements binary search and is rather slow.
Value
dcusp
gives the density function, pcusp
gives the distribution function, qcusp
gives the quantile function, and rcusp
generates observations.
Author(s)
Raoul Grasman
References
See cusp-package
, integrate
See Also
Examples
# evaluate density and distribution
dcusp(0,2,3)
pcusp(0,2,3)
pcusp(qcusp(0.125,2,3),2,3) # = 0.125
# generate cusp variates
rcusp(100, 2, 3)
# generate cusp variates for random normal and splitting factor values
alpha = runif(20, -3, 3)
beta = runif(20, -3, 3)
Vectorize(rcusp)(1, alpha, beta)