df <- data.frame(y = gl(3, 2), x = gl(3, 2)[sample(1:6)])
  ### Cochran-Mantel-Haenzel Test
  ct <- cmh_test(y ~ x, data = df)
 
  ### the linear statistic, i.e, the contingency table
  l <- statistic(ct, type = "linear")
  l
  ### expectation
  El <- expectation(ct)
  El
  ### covariance
  Vl <- covariance(ct)
  Vl
  ### the standardized contingency table (hard way)
  (l - El) / sqrt(variance(ct))
  ### easy way
  statistic(ct, type = "standardized")Run the code above in your browser using DataLab