cor_cyl: Estimate a Rank-Based Circular-Linear Correlation Coefficient

View source: R/correlation.R

cor_cylR Documentation

Estimate a Rank-Based Circular-Linear Correlation Coefficient

Description

The code is based on \insertCiteMardia1976;textualcylcop, \insertCiteSolow1988;textualcylcop and \insertCiteTu2015;textualcylcop. The function returns a numeric value between 0 and 1, not -1 and 1, positive and negative correlation cannot be discerned. Note also that the correlation coefficient is independent of the marginal distributions.

Usage

cor_cyl(theta, x)

Arguments

theta

numeric vector of angles (measurements of a circular variable).

x

numeric vector of step lengths (measurements of a linear variable).

Value

A numeric value between 0 and 1, the circular-linear correlation coefficient.

References

\insertRef

Mardia1976cylcop

\insertRef

Solow1988cylcop

\insertRef

Tu2015cylcop

\insertRef

Hodelmethodcylcop

See Also

mi_cyl(), fit_cylcop_cor().

Examples

set.seed(123)

cop <- cyl_quadsec(0.1)

#draw samples and calculate the correlation coefficient
sample <- rcylcop(100, cop)
cor_cyl(theta = sample[,1], x = sample[,2])

#the correlation coefficient is independent of the marginal distribution.
sample <- traj_sim(100,
  cop,
  marginal_circ = list(name = "vonmises", coef  = list(0, 1)),
  marginal_lin = list(name = "weibull", coef = list(shape = 2))
)
cor_cyl(theta = sample$angle, x = sample$steplength)
cor_cyl(theta = sample$cop_u, x = sample$cop_v)

# Estimate correlation of samples drawn from circular-linear copulas with
# perfect correlation
cop <- cyl_rect_combine(copula::normalCopula(1))
sample <- rcylcop(100, cop)
cor_cyl(theta = sample[,1], x = sample[,2])


cylcop documentation built on Oct. 30, 2022, 1:05 a.m.