assoc.xx.Rd
Computes bivariate association measures between every pairs of variables from a data frame.
assoc.xx(x, weights = NULL, correlation = "kendall",
na.rm.cat = FALSE, na.value.cat = "NAs", na.rm.cont = FALSE,
nperm = NULL, distrib = "asympt", dec = c(3,3))
the data frame of variables
numeric vector of weights. If NULL (default), uniform weights (i.e. all equal to 1) are used.
character. The type of measure of correlation measure to use between two continuous variables : "pearson", "spearman" or "kendall" (default).
logical, indicating whether NA values in the categorical variables should be silently removed before the computation proceeds. If FALSE (default), an additional level is added to the categorical variables (see na.value.cat argument).
character. Name of the level for NA category. Default is "NAs". Only used if na.rm.cat = FALSE.
logical, indicating whether NA values in the continuous variables should be silently removed before the computation proceeds. Default is FALSE.
numeric. Number of permutations for the permutation test of independence. If NULL (default), no permutation test is performed.
the null distribution of permutation test of independence can be approximated by its asymptotic distribution ("asympt"
, default) or via Monte Carlo resampling ("approx"
).
vector of 2 integers for number of decimals. The first value if for association measures, the second for permutation p-values. Default is c(3,3).
The function computes an association measure : Pearson's, Spearman's or Kendall's correlation for pairs of numeric variables, Cramer's V for pairs of factors and eta-squared for pairs numeric-factor. It can also compute the p-value of a permutation test of association for each pair of variables.
A table with the following elements :
: name of the association measure
: value of the association measure
: p-value from the permutation test
data(iris)
iris2 = iris
iris2$Species = factor(iris$Species == "versicolor")
assoc.xx(iris2, nperm = 10)
#> variable1 variable2 measure association permutation.pvalue
#> 1 Sepal.Width Species Eta2 0.219 0.000
#> 2 Petal.Length Petal.Width Kendall tau 0.807 0.000
#> 3 Sepal.Length Petal.Length Kendall tau 0.719 0.000
#> 4 Sepal.Length Petal.Width Kendall tau 0.655 0.000
#> 5 Petal.Length Species Eta2 0.041 0.000
#> 6 Sepal.Width Petal.Length Kendall tau -0.186 0.000
#> 7 Sepal.Length Species Eta2 0.006 0.000
#> 8 Sepal.Width Petal.Width Kendall tau -0.157 0.013
#> 9 Sepal.Length Sepal.Width Kendall tau -0.077 0.047
#> 10 Petal.Width Species Eta2 0.014 0.419