basic function.txt includes following functions: 1, mychisq(data) where data is 2 by J contingency table; 2, rmn(n,size,prob): randomly generate n mulnomial variates; 3, score(K): generate K*(K+1)/2 by K-1 additive effects score matrix with K-allelic loci; 4, CATK(data,K): Cochran-Armitage's trend test: for K-allelic loci with score matrix x; 5, genK.data(n1, n0,alpha,beta=rep(0,K-1),p,K,x=matrix(0,nrow=K*(K+1)/2,ncol=K-1)): generate data from logistic regression with intercept alpha and scale beta for K-allelic loci with score matrix x; 6: CATK2(data,x): Cochran-Armitage trend test for score vector x=(x1,x2,...xj); 7: genJ.data(n1=n1,n2=n2,n3=n3,n4=n4,alpha,beta,x): generate 2 by 4 contigency table from logistic regression with intercept alpha, scale beta and with score vector x; threshold-power-score matrix.txt is a R function (min2) to calculate threshold and power for min2 and pearson's test, Cochran-Armitage trend test with score matrix. The User should specify the following parameters: n0: number of controls; n1: number of cases; p: allele frequencies of all alleles; beta1,beta2: genetic effect of risk alleles (beta1=beta2=0 stands for null) K: number of alleles at the given loci; x: K*(K+1)/2 by K-1 score matrix; N.null: number of replicates under null in order to calculate threshold; N.power: number of replicates to calculate power; threshold-power-score vector.txt is a R function (general.min2) to calculate threshold and power for min2 and pearson's test, Cochran-Armitage trend test with score vector. The User should specify the parameters same as threshold-power-score matrix.txt does except x is a vector. permutation.txt includes a R function (pvalues) which returns p-values of min2, pearson's test and Cochran-Armitage test. The user should specify the original data in 2 by J contingency table and the score vector x.