For some small sample sizes I would like to exemplify the combinatorics underlying certain nonparametric tests like Mann-Whitney-Wilcoxon, Kruskal-Wallis and Spearman's rank correlation. I have written a function all.perm which delivers all permutations of 1,2,...,n and which works reasonably well. This can be used to generate P(R=r) of Spearman's rank correlation: n_6;plot(table(apply(all.perm(n),1,cor,y=1:n)),type="h") all.perm_function(n){ p_matrix(1,ncol=1) for(i in 2:n){p_pp_cbind(p,i) v_c(1:i,1:(i-1)) for(j in 2:i){v_v[-1] p_rbind(p,pp[,v[1:i]])}} p} Until now I hesitated to dwell on writing functions to generate all n!/(k!(n-k)!) k-combinations of an n-element set or more generally all n!/(k_1!k_2!...n_k!) choices of placing n objects into k boxes where box j has n_j objects. Not intending to re-invent the wheel I turn to the R community to ask if someone has already written these functions. Any help is thankfully appreciated. --- D.Trenkler --- ************************************************************************ ********* Dietrich Trenkler (trenkler at oec.uni-osnabrueck.de) Statistik / Empirische Wirtschaftsforschung Universitaet Osnabrueck Rolandstrasse 8 Phone: +49(0) 541-969-2753 D-49069 Osnabrueck Fax : +49(0) 541-969-2744 GERMANY ************************************************************************ ********* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._