Learn R Programming

complex (version 1.0.0)

cvar: Correlation, Variance and Covariance (Matrices) for complex variables

Description

Functions cvar(), ccov() and ccor() return respectively complex variance, covariance and correlation based on the provided complex vector/matrix x. Function covar() returns the covariance matrix based on a complex vector/matrix.

Usage

cvar(x, method = c("direct", "conjugate"), df = NULL, ...)

ccov(x, y, method = c("direct", "conjugate"), df = NULL, ...)

ccor(x, y, method = c("direct", "conjugate", "pearson", "kendall", "spearman"), ...)

ccov2cor(V)

covar(x, df = NULL)

Value

A scalar or a matrix with resulting complex variables.

Arguments

x

vector or matrix of complex variables. If it is matrix then the variable y is ignored.

method

method to use in the calculation of the measure. "conjugate" means that it is based on the multiplication by conjugate number. "direct" means the calculation without the conjugate (i.e. "pseudo" moment). For ccor the variable method can also be "pearson", "kendall", or "spearman", defining what correlation coefficient to use after the MDS transformation of complex variables x and y.

df

Number of degrees of freedom to use in the calculation of the statistics.

...

parameters passed to mean() functions. For example, this can be na.rm=TRUE to remove missing values or trim to define the trimming in the mean (see mean).

y

second vector to calculate covariance or correlations with.

V

complex (pseudo)covariance matrix.

Author

Ivan Svetunkov, ivan@svetunkov.ru

Details

Only the parametric correlation is supported by the function. If x is matrix, then y is ignored.

covar() function returns a covariance matrix calculated for the provided complex vector or matrix x.

References

  • Svetunkov, S. & Svetunkov I. (2022) Complex Autoregressions. In Press.

See Also

Examples

Run this code

# Generate random complex variables
x <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10))
y <- complex(real=rnorm(100,10,10), imaginary=rnorm(100,10,10))

# Create a matrix of complex variables
z <- cbind(x,y)

# Calculate measures
cvar(x)
cvar(z)
ccor(x,y)
ccor(z)

Run the code above in your browser using DataLab