function [cv, pval] = pairpermute(y, cov, geno, chrid, nperm) %permutation test for joint effects of two markers %this program computes the permutation test described in % Sugiyama et al, 1999 %The test compares unconstrained regression model with full interaction % term to a null model % %Input Variable: % y: nx1 vector of trait values % cov: nx1 vector of covariates, use [] if none % geno: nxm genotyping array, encoded as 0-1 or as 0-1-2 % chrid: mx1 vector = chromosome number associated with markers % nperm: number of permutations %OUTPUT VARIABLES % F1: the overall F-test mxm but only the lower triangle (i1 F1 = pairwise(y, cov, geno, chrid); pval = sum(Fmax(:) > max(F1(:)))/nperm; end