Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

CVs

Coeficients of Variation


Description

The function returns the Coeficient of Variation (CV) of a matrix with quantitative columns.

Usage

CVs(X, dummy = FALSE, pos = NULL)

Arguments

X

A numeric design matrix that should contain more than one regressor (intercept included).

dummy

A logical value that indicates if there are dummy variables in the design matrix X. By default dummy=FALSE.

pos

A numeric vector that indicates the position of the dummy variables, if these exist, in the design matrix X. By default pos=NULL.

Details

Due to the calculation of the CV only makes sense for quantitative data, other kind of data should be ignored in the calculation. For this reason, it is necessary to indicate if there are non-quantitative variables and also its position in the matrix.

Value

The CV of each column of X.

Author(s)

R. Salmerón (romansg@ugr.es) and C. García (cbgarcia@ugr.es).

See Also

Examples

# random

cte = array(1, 50)
x1 = sample(1:50, 25)
x2 = sample(1:50, 25)
Z = cbind(cte, x1, x2)
head(Z)
CVs(Z)

x3 = sample(c(array(1,25), array(0,25)), 25)
W = cbind(Z, x3)
head(W)
CVs(W, dummy=TRUE, pos = 4)

x0 = sample(c(array(1,25), array(0,25)), 25)
Y = cbind(cte, x0, x1, x2, x3)
head(Y)
CVs(Y, dummy=TRUE, pos=c(2,5))

multiColl

Collinearity Detection in a Multiple Linear Regression Model

v1.0
GPL (>= 2)
Authors
R. Salmeron, C.B. Garcia and J. Garcia
Initial release
2019-07-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.