Measures the association between a categorical variable and a continuous variable

assoc.catcont(x,y,weights=rep(1,length(x)),
              nperm=NULL,distrib="asympt",digits=3)

Arguments

x

the categorical variable (must be a factor)

y

the continuous variable (must be a numeric vector)

weights

an optional numeric vector of weights (by default, a vector of 1 for uniform weights)

nperm

numeric. Number of permutations for the permutation test of independence. If NULL (default), no permutation test is performed.

distrib

the null distribution of permutation test of independence can be approximated by its asymptotic distribution ("asympt", default) or via Monte Carlo resampling ("approx".

digits

integer. The number of digits (default is 3).

Value

A list with the following elements :

eta.squared

eta-squared between the two variables

permutation.pvalue

p-value from a permutation (so non-parametric) test of independence

cor

point biserial correlation between the two variables, for each level of the categorical variable

cor.perm.pval

permutation p-value of the correlation between the two variables, for each level of the categorical variable

References

Rakotomalala R., 'Comprendre la taille d'effet (effect size)', [http://eric.univ-lyon2.fr/~ricco/cours/slides/effect_size.pdf]

Author

Nicolas Robette

See also

Examples

## Annette Dobson (1990) "An Introduction to Generalized Linear Models". ## Page 9: Plant Weight Data. ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2, 10, 20, labels = c("Ctl","Trt")) weight <- c(ctl, trt) assoc.catcont(group,weight,nperm=100)
#> $eta.squared #> [1] 0.0730776 #> #> $permutation.pvalue #> [1] 0.3973848 #> #> $cor #> Ctl Trt #> 0.27 -0.27 #> #> $cor.perm.pval #> Ctl Trt #> 0.1244044 0.1318132 #>