association | R Documentation |
Function returns the matrix of measures of association for different types of variables.
association(x, y = NULL, use = c("na.or.complete", "complete.obs",
"everything", "all.obs"), method = c("auto", "pearson", "spearman",
"kendall", "cramer"))
assoc(x, y = NULL, use = c("na.or.complete", "complete.obs", "everything",
"all.obs"), method = c("auto", "pearson", "spearman", "kendall", "cramer"))
x |
Either data.frame or a matrix |
y |
The numerical variable. |
use |
What observations to use. See cor function for details.
The only option that is not available here is |
method |
Which method to use for the calculation of measures of association.
By default this is
Be aware that the wrong usage of measures of association might give misleading results. |
The function looks at the types of the variables and calculates different measures depending on the result:
If both variables are numeric, then Pearson's correlation is calculated;
If both variables are categorical, then Cramer's V is calculated;
Finally, if one of the variables is categorical, and the other is numeric, then multiple correlation is returned.
After that the measures are wrapped up in a matrix.
Function also calculates the p-values associated with the respective measures (see the return).
See details in the vignette "Marketing analytics with greybox":
vignette("maUsingGreybox","greybox")
assoc()
is just a short name for the association{}
.
The following list of values is returned:
value - Matrix of the coefficients of association;
p.value - The p-values for the parameters;
type - The matrix of the types of measures of association.
Ivan Svetunkov, ivan@svetunkov.com
table, tableplot, spread,
cramer, mcor
association(mtcars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.