How can I calculate statistical significance in a table with percentages? I have a table with information about students in three different classes. In each class there are two groups of people - those, who had prior training and those, who did not. Now, when some time passed by from start point of education, some people have been expelled. The table is following:




Class
Expelled
Active students
Total
% expelled
Had prior training
Had no prior training
% had prior training




1
77
255
332
30.20%
199
133
59.94%


2
54
154
208
25.96%
154
54
74.04%


3
93
136
229
40.61%
122
107
53.28%




My hypothesis is that classes with more percent of people, who had prior training, have less percent of expelled. For example, Class 2 has the highest % of those who had prior training and least % of expelled.
The problem is that I don't know how to calculate statistical significance. I though about using Chi-square contingency table and to compare pairs (Class 2 vs Class 3, Class 2 vs Class 3), but I don't know how what numbers from my table should I put there.
What is the appropriate method for this case and how should I use it?

Cochran-Mantel-Haenszel Test can  be used here.
I assume you already have the contingency tables for each class (based on training and being expelled or not). Here I provide a sample code (I created a sample data for you):
#class_1----
class_1 <- as.table(rbind(c(50,100),c(100,50)))
dimnames(class_1) <- list(training = c("yes","no"),
                          expelled = c("yes","no"))
#class_2----
class_2 <- as.table(rbind(c(40,100),c(120,50)))
dimnames(class_2) <- list(training = c("yes","no"),
                          expelled = c("yes","no"))
#class_3----
class_3 <- as.table(rbind(c(60,100),c(130,70)))
dimnames(class_3) <- list(training = c("yes","no"),
                          expelled = c("yes","no"))

#as you can see, you need a 3 dimensional table for this test
joined_table <- array(c(class_1,class_2,class_3),dim = c(2,2,3))

mantelhaen.test(joined_table)

output:
data:  joined_table
Mantel-Haenszel X-squared = 109.42, df = 1, p-value < 2.2e-16
alternative hypothesis: true common odds ratio is not equal to 1
95 percent confidence interval:
 0.1870675 0.3197568
sample estimates:
common odds ratio 
        0.2445733 

