var: Variance and standard deviation of complex vectors

Description Usage Arguments Details Author(s) Examples

Description

Complex generalizations of stats::sd() and stats::var()

Usage

1
2
var(x, y=NULL, na.rm=FALSE,use)
sd(x, na.rm=FALSE)

Arguments

x,y

Complex vector or matrix

na.rm

Boolean with default FALSE meaning to leave NA values present and TRUE meaning to remove them

use

Ignored

Details

Intended to be broadly compatible with stats::sd() and stats::var().

If given real values, var() and sd() return the variance and standard deviation as per ordinary real analysis. If given complex values, returns the complex generalization in which Hermitian transposes are used.

If z is a complex matrix, var(z) returns the variance of the rows.

These functions use n-1 on the denominator purely for consistency with stats::var() (for the record, I disagree with the rationale for n-1).

Author(s)

Robin K. S. Hankin

Examples

1
2
3
sd(rcnorm(10)) # imaginary component suppressed by zapim()

var(rcmvnorm(1e5,mean=c(0,0)))

cmvnorm documentation built on Aug. 16, 2018, 9:05 a.m.