CVs | R Documentation |
The function returns the Coeficient of Variation (CV) of a matrix with quantitative columns.
CVs(X, dummy = FALSE, pos = NULL)
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 |
pos |
A numeric vector that indicates the position of the dummy variables, if these exist, in the design matrix |
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.
The CV of each column of X
.
R. Salmerón (romansg@ugr.es) and C. García (cbgarcia@ugr.es).
CV
.
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.