Cobb's Cusp Distribution

Share:

Description

Functions for the cusp distribution.

Usage

1
2
3
4
5
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 cusp-package.

rel.tol

See cusp-package.

abs.tol

See cusp-package.

stop.on.error

See cusp-package.

aux

See cusp-package.

keep.order

logical. If true the order of the output values is the same as those of the input values y

Details

The cusp distribution is defined by

f(y) = Ψ \exp(α y + β y^2/2 - y^4/4),

where Ψ 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

cusp-package

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
    # 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)