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 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) = \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

cusp-package

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)

[Package cusp version 2.3.6 Index]