Covariance matrix for circular variables?

Viewed 157

In my current project, I have a collection of three-dimensional samples such as [-0.5,-0.1,0.2]*pi, [0.8,-0.1,-0.4]*pi. These variables are circular/periodic, with their values ranging from -pi to +pi. It is my goal to calculate a 3-by-3 covariance matrix for these circular variables.

Python has an in-built function to calculate circular standard deviations, which I can use to calculate the standard deviations along each dimension, then use them to create a diagonal covariance matrix (i.e., without any correlation). Ideally, however, I would like to consider correlations between the parameters as well. Is there a way to calculate correlations between circular variables, or to directly compute the covariance matrix between them?

import numpy as np
import scipy.stats

# A collection of N circular samples
samples = np.asarray(
    [[0.384917, 1.28862,    -2.034],
    [0.384917,  1.28862,    -2.034],
    [0.759245,  1.16033,    -2.57942],
    [0.45797,   1.31103,    2.9846],
    [0.898047,  1.20955,    -3.02987],
    [1.25694,   1.74957,    2.46946],
    [1.02173,   1.26477,    1.83757],
    [1.22435,   1.62939,    1.99264]])

# Calculate the circular standard deviations
stds    = scipy.stats.circstd(samples, high = np.pi, low = -np.pi, axis = 0)

# Create a diagonal covariance matrix
cov     = np.identity(3)
np.fill_diagonal(cov,stds**2)
0 Answers
Related