I am using R's r2dtable
function to generate contingency tables with given marginals. However, when inspecting the resulting tables values look somewhat too concentrated to the midpoints. Example:
set.seed(1)
matrices <- r2dtable(1e4, c(100, 100), c(100, 100))
vec.vals <- vapply(matrices, function(x) x[1, 1], numeric(1))
> table(vec.vals)
vec.vals
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
1 1 1 7 25 49 105 182 268 440 596 719 954 1072 1152 1048
52 53 54 55 56 57 58 59 60 61 62
1022 775 573 404 290 156 83 50 19 6 2
So the minimal upper left corner value is 36 and the max is 62 out of 10,000 simulations.
Is there a way to achieve somewhat less concentrated matrices?