Description Usage Arguments Details Value Examples
corrmat
returns a correlation matrix of a data.frame. Several different
correlation methods can be choosen and the matrix can be created for column or row
relations.
1 2 |
matrix |
data.frame with numeric values |
method |
switch to define which contingency value should be used: "chi2" (default): test decision of the chi-square test for a defined decision niveau. A significant relation of two variables/objects is marked with a numeric "1", a negativ test result with a numeric "0". "phi": Pearson's phi coefficient ("mean square contingency coefficient"). "cc": Pearson's contingency coefficient. "lambda": Goodman and Kruskal's lambda value. Mean of both values calculated depending on what's the dependent and what's the independent variable |
dim |
switch to define if the correlation matrix should be created for columns or rows. 1 (default): table is created for column (variables) relations. 2: table is created for row (objects) relations. |
chi2limit |
significance level for the test decision. Just relevant for method "chi2". The higher chi2limit the less results will get removed. default: 0.05 -> 5% |
rmnegniv |
option allows to remove "negativ relations". If >0 |
The rmnegniv option allows to remove "negativ relations", by activating the rmnegcorr function for values >0. The smaller rmnegniv the weaker the overlap of two variables/objects can be, to still be recognised as the cause of a positiv relation.
See ?rmnegcorr
for further info. This function can also be applied later.
correlation matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | testmatrixrand <- data.frame(
matrix(base::sample(0:1,400,replace=TRUE), nrow=20, ncol=20)
)
corrmat(testmatrixrand, "chi2", chi2limit = 0.03)
corrmat(matrix = testmatrixrand, method = "lambda", dim = 2)
phicorrtable <- corrmat(
matrix = testmatrixrand,
method = "phi",
dim = 1
)
# Without negative relations:
phicorrtablewnr <- corrmat(
matrix = testmatrixrand,
method = "phi",
dim = 1,
rmnegniv = 0.1
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.