cor.circular: Correlation Coefficient for Angular Variables

Description Usage Arguments Details Value Author(s) References Examples

View source: R/cor.circular.R

Description

Computes a circular version of the Pearson's product moment correlation, and performs a significance test if requested.

Usage

1
cor.circular(x, y=NULL, test=FALSE)

Arguments

x

vector or matrix of circular data.

y

vector or matrix of circular data.

test

if test == TRUE, then a significance test for the correlation coefficient is computed.

Details

The correlation coefficient is computed like Pearson's product moment correlation for two linear variables X and Y. In the computational formula, however, (xi - xbar) and (yi - ybar) are replaced by sin(xi - xbar) and sin(yi - ybar), where xbar and ybar in the second two expressions are the mean directions of the samples.

Value

Returns a vector or a matrix of a circular version of the Pearson's product moment correlation, if test == TRUE then a list is reported with statistic and p.value, the test statistic and p-value respectively, for testing significance of the correlation coefficient.

Author(s)

Claudio Agostinelli and Ulric Lund

References

Jammalamadaka, S. Rao and SenGupta, A. (2001). Topics in Circular Statistics, Section 8.2, World Scientific Press, Singapore.

Jammalamadaka, S. and Sarma, Y. (1988). A correlation coefficient for angular variables. Statistical Theory and Data Analysis 2. North Holland: New York.

Examples

1
2
3
4
# Generate two circular data sets, and compute their correlation.
x <- rvonmises(n=50, mu=circular(0), kappa=3)
y <- x + rvonmises(n=50, mu=circular(pi), kappa=10)
cor.circular(x, y, test=TRUE)

Example output

Attaching package: 'circular'

The following objects are masked from 'package:stats':

    sd, var

$cor
[1] 0.9338005

$statistic
[1] 5.03145

$p.value
[1] 4.867846e-07

circular documentation built on May 1, 2019, 7:57 p.m.