Learn R Programming

cylcop (version 0.2.0)

Cylcop: 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 matrix,Copula dcylcop(u, copula)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

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.

References

Nelsen2006cylcop

Hodelmethodcylcop

See Also

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

Examples

Run this code
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)

Run the code above in your browser using DataLab