Cylcop {cylcop}R Documentation

Distribution, Density, and Random Number Generation for Circular-Linear Copulas'

Description

Calculate the distribution (pcylcop()), the density (dcylcop()), and generate random samples (rcylcop()) of a 'cyl_copula' object or a 'Copula' object (package 'copula', only 2-dimensional).

Usage

pcylcop(u, copula)

rcylcop(n, copula)

dcylcop(u, copula, log = FALSE)

## S4 method for signature 'matrix,Copula'
dcylcop(u, copula)

## S4 method for signature 'numeric,Copula'
rcylcop(n, copula)

## S4 method for signature 'matrix,Copula'
pcylcop(u, copula)

## S4 method for signature 'numeric,cyl_cubsec'
rcylcop(n, copula)

## S4 method for signature 'matrix,cyl_cubsec'
dcylcop(u, copula)

## S4 method for signature 'matrix,cyl_cubsec'
pcylcop(u, copula)

## S4 method for signature 'numeric,cyl_quadsec'
rcylcop(n, copula)

## S4 method for signature 'matrix,cyl_quadsec'
dcylcop(u, copula)

## S4 method for signature 'matrix,cyl_quadsec'
pcylcop(u, copula)

## S4 method for signature 'numeric,cyl_rect_combine'
rcylcop(n, copula)

## S4 method for signature 'matrix,cyl_rect_combine'
dcylcop(u, copula)

## S4 method for signature 'matrix,cyl_rect_combine'
pcylcop(u, copula)

## S4 method for signature 'numeric,cyl_rot_combine'
rcylcop(n, copula)

## S4 method for signature 'matrix,cyl_rot_combine'
dcylcop(u, copula)

## S4 method for signature 'matrix,cyl_rot_combine'
pcylcop(u, copula)

## S4 method for signature 'numeric,cyl_vonmises'
rcylcop(n, copula)

## S4 method for signature 'matrix,cyl_vonmises'
dcylcop(u, copula)

## S4 method for signature 'matrix,cyl_vonmises'
pcylcop(u, copula)

Arguments

u

matrix (or vector) of numeric values in [0,1]^2, containing as first column the circular (periodic) and as second the linear dimension

copula

R object of class 'cyl_copula'. or 'Copula' (package 'copula', only 2-dimensional).

n

number of random samples to be generated with rcylcop().

log

logical indicating if the logarithm of the density should be returned (dcylcop()).

Details

For 'Copula' objects, pcylcop() and rcylcop() just call the functions of the 'copula' package pCopula() and rCopula(), respectively. The density is, however, calculated differently in dcylcop() and dCopula(). The difference is that copula::dCopula() will return a density of 0 for points on the boundary of the unit square, whereas dcylcop() will return the correct density on the boundaries for both 'cyl_copula' and 'Copula' objects.

Value

The functions pcylcop() and dcylcop() give a vector of length nrow(u) containing the distribution and the density, respectively, at the corresponding values of u. The function rcylcop() generates a matrix with 2 columns and n rows containing the random samples.

References

Nelsen RB (2006). An Introduction to Copulas, volume 139 of Lecture Notes in Statistics. Springer New York, New York, NY. ISBN 978-0-387-98623-4, doi:10.1007/978-1-4757-3076-0, https://link.springer.com/book/10.1007/978-1-4757-3076-0.

Hodel FH, Fieberg JR (2021). “Cylcop: An R Package for Circular-Linear Copulae with Angular Symmetry.” bioRxiv. doi:10.1101/2021.07.14.452253, https://www.biorxiv.org/content/10.1101/2021.07.14.452253v3/.

See Also

copula::dCopula(), copula::pCopula(), copula::rCopula().

Examples

set.seed(123)

cop <- cyl_quadsec(0.1)
rcylcop(5, cop)
pcylcop(c(0.3, 0.1), cop)
pcylcop(rbind(c(0.3, 0.1), c(0.2, 1)), cop)

cop <- cyl_rot_combine(copula::frankCopula(2), shift = TRUE)
dcylcop(u = rbind(c(0.1, 0.4), c(1.0, 0.2)), copula = cop)
dcylcop(c(0.1, 0.3), cyl_quadsec(0.1), log = TRUE)

cop <- copula::normalCopula(0.3)
copula::dCopula(c(.Machine$double.eps,0.2),cop)
copula::dCopula(c(0,0.2),cop)
dcylcop(c(.Machine$double.eps,0.2),cop)
dcylcop(c(0,0.2),cop)


[Package cylcop version 0.2.0 Index]