Last data update: 2014.03.03

R: Squared Coefficient of Variation
CV2R Documentation

Squared Coefficient of Variation

Description

Squared Coefficient of Variation.

Usage

   CV2(x)

Arguments

x

Numeric vector or matrix.

Details

Compute the squared Coefficient of Variation of one or several samples provided as a numeric vector or matrix.

Value

Numeric vector of the squared coefficients of variation.

Note

The squared coefficient of variation is the ratio S^2/xbar^2 where xbar and S^2 are the sample mean and the sample variance. The variance is computed using the sample size n as denominator, rather than the usual n-1.

Examples

n <- 30; nSamp <- 500
X <- matrix(rexp(n * nSamp), nrow= nSamp, ncol = n)
W <- CV2(X)
plot(density(W), main = "CV2 of exponential samples")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Renext)
Loading required package: evd
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Renext/CV2.Rd_%03d_medium.png", width=480, height=480)
> ### Name: CV2
> ### Title: Squared Coefficient of Variation
> ### Aliases: CV2
> 
> ### ** Examples
> 
> n <- 30; nSamp <- 500
> X <- matrix(rexp(n * nSamp), nrow= nSamp, ncol = n)
> W <- CV2(X)
> plot(density(W), main = "CV2 of exponential samples")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>