Learn R Programming

copBasic (version 2.2.6)

asCOP: Wrapper on a User-Level Formula to Become a Copula Function

Description

This function is intended to document and then to extend a simple API to end users to aid in implementation of other copulas for use within the copBasic package. There is no need or requirement to use asCOP for almost all users. However, for the mathematical definition of some copulas, the asCOP function might help considerably. This is because there is a need for special treatment of \(u\) and \(v\) vectors of probability as each interacts with the vectorization implicit in R. The special treatment is needed because many copulas are based on the operators such as min() and max(). When numerical integration used by the integrate() function in R in some copula operators, such as tauCOP for the Kendall Tau of a copula, special accommodation is needed related to the inherent vectorization in R and how integrate() works.

Basically, the problem is that one can not strictly rely in all circumstances on what R does in terms of value recycling when \(u\) and \(v\) are of unequal lengths. The source code is straightforward. Simply put, if lengths of \(u\) and \(v\) are unity, then there is no concern, and even if the length of \(u\) (say) is unity and \(v\) is 21, then recycling of \(u\) would often be okay. The real danger is when \(u\) and \(v\) have unequal lengths and those lengths are each greater than unity---the R treatment can not be universally relied upon with the various numerics herein involving optimization and nested numerical integration.

The example shows how a formula definition of a copula that is not a copula already implemented by copBasic is set into a function deltacop and then used inside another function UsersCop that will be the official copula that is compatible with a host of functions in copBasic. The use of asCOP provides the length check necessary on \(u\) and \(v\), and the argument ... provides optional parameter support should the user's formula require more settings.

Usage

asCOP(u, v, f=NULL, ...)

Value

The value(s) for the copula are returned.

Arguments

u

Nonexceedance probability \(u\) in the \(X\) direction;

v

Nonexceedance probability \(v\) in the \(Y\) direction;

f

A function for which the user desires to make as a copula; and

...

Additional arguments to pass to the function f (such as parameters, if needed, for the copula in the form of a list).

Author

W.H. Asquith

References

Nelsen, R.B., 2006, An introduction to copulas: New York, Springer, 269 p.

See Also

COP