var {cmvnorm}R Documentation

Variance and standard deviation of complex vectors

Description

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

Usage

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


sd(rcnorm(10)) # imaginary component suppressed by zapim()

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

[Package cmvnorm version 1.0-7 Index]