########################################################################## # Perform a multivariate two-sample permutation test (actually, an approximate # randomization test) for the Cramer statistic (the null examines location # differences) # # Enter Data jimenez<-matrix(c(1, 1, 1.0, 2.5, 2.5, 2, 1, 1.0, 2.5, 2.5, 3, 1, 2.0, 1.0, 3.0, 4, 1, 1.5, 1.5, 3.0, 5, 2, 1.5, 1.5, 3.0, 6, 2, 1.5, 1.5, 3.0, 7, 2, 1.0, 2.0, 3.0, 8, 2, 1.5, 1.5, 3.0, 9, 2, 1.5, 1.5, 3.0), ncol=5, byrow=T, dimnames=list(1:9,c("ID","GROUP","TENSE","PERSON","NUMBER"))) # Display Data jimenez # Some preliminaries: # # Display Correlation of dependent variables # Notice that each of the three pairwise correlations is large # A Bonferonni critical alpha value will need to be used (e.g. .05/3=.0167) cor(jimenez[,3:5]) # Calculate Friedman rank test on dv's as a set, # Then test each of the three pairwise variables library(stats) # Set of three: TENSE, PERSON, NUMBER friedman.test(jimenez[,3:5]) # TENSE with PERSON # perform test with alpha.crit = .0167 friedman.test(jimenez[,3:4]) # PERSON with NUMBER # perform test with alpha.crit = .0167 friedman.test(jimenez[,4:5]) # TENSE with NUMBER # perform test with alpha.crit = .0167 friedman.test(jimenez[,3:5]) ############################################################################ # # Perform a multivariate two-sample permutation test (using cramer statistic) # The null hypothesis tests whether location is equivalent for the two groups # # Rows 1-4 with columns 3,4,5 (grp 1 with variables TENSE, PERSON, NUMBER) # Rows 5-9 with columns 3,4,5 (grp 2 with variables TENSE, PERSON, NUMBER) # Attach library library(cramer) cramer.test(jimenez[1:4,3:5], jimenez[5:9,3:5], sim="permutation", replicates=10000, kernel="phiCramer")