Computes bivariate association measures between a response and predictor variables (and, optionnaly, between every pairs of predictor variables.)

assoc.yx(y, x, weights=rep(1,length(y)), xx = TRUE, twocont="kendall",
nperm=NULL, distrib="asympt", dec=c(3,3))

## Arguments

y the response variable the predictor variables an optional numeric vector of weights (by default, a vector of 1 for uniform weights) whether the association measures should be computed for couples of predictor variables (default) or not. With a lot of predictors, consider setting xx to FALSE (for reasons of computation time). character. The type of measure of correlation measure to use between two continuous variables : "pearson", "spearman" or "kendall" (default). 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).

## Details

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.

## Value

A list of the following items :

YX

: a table with the association measures between the response and predictor variables

XX

: a table with the association measures between every pairs of predictor variables

In each table :
measure

: name of the association measure

association

: value of the association measure

permutation.pvalue

: p-value from the permutation test

## Author

Nicolas Robette

data(iris) iris2 = iris iris2$Species = factor(iris$Species == "versicolor") assoc.yx(iris2$Species,iris2[,1:4],nperm=100) #>$YX #> variable measure association permutation.pvalue #> 1 Sepal.Width Eta2 0.219 0.000 #> 2 Petal.Length Eta2 0.041 0.000 #> 3 Petal.Width Eta2 0.014 0.218 #> 4 Sepal.Length Eta2 0.006 0.489 #> #> \$XX #> variable1 variable2 measure association permutation.pvalue #> 1 Petal.Length Petal.Width Kendall's tau 0.807 0.000 #> 2 Sepal.Length Petal.Length Kendall's tau 0.719 0.000 #> 3 Sepal.Length Petal.Width Kendall's tau 0.655 0.000 #> 4 Sepal.Width Petal.Length Kendall's tau -0.186 0.000 #> 5 Sepal.Width Petal.Width Kendall's tau -0.157 0.003 #> 6 Sepal.Length Sepal.Width Kendall's tau -0.077 0.071 #>