Okay I have figured out the issue. I will fix it so it works the way you expected it to work. Before the fix goes live though it should work to do:
ChisqTest([1,2,3,4],[1,2,2,4], 4) *note the 4 The issue was when I submitted the code to HypothesisTests.jl the only way to create a contingency table between two vectors x and y was to also provide the levels that the categorical variables could take on. Afterwards I submited a version to StatsBase.jl for ``counts`` that had default values, but I forgot to update my code at HypothesisTests.jl. Sorry for the late response! **Note the above will give you what is equivalent in R to: > chisq.test(matrix(c(1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1),nrow = 4,ncol = 4)) Pearson's Chi-squared test data: matrix(c(1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1), nrow = 4, ncol = 4) X-squared = NaN, df = 9, p-value = NA Warning message: In chisq.test(matrix(c(1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, : Chi-squared approximation may be incorrect However you are probably interested in > chisq.test(c(1,2,3,4),c(1,2,2,4)) Pearson's Chi-squared test data: c(1, 2, 3, 4) and c(1, 2, 2, 4) X-squared = 8, df = 6, p-value = 0.2381 When I wrote up the function there wasn't a good equivalent of R's ``table`` function. I will try to flesh out this code so it works closer to R. In the meantime the best thing is to work with the full contingency table i.e.: julia> ChisqTest([1 0 0; 0 1 0; 0 1 0; 0 0 1]) Pearson's Chi-square Test ------------------------- Population details: parameter of interest: Multinomial Probabilities value under h_0: [0.0625,0.0625,0.0625,0.0625,0.125,0.125,0.125,0.125,0.0625,0.0625,0.0625,0.0625] point estimate: [0.25,0.0,0.0,0.0,0.0,0.25,0.25,0.0,0.0,0.0,0.0,0.25] 95% confidence interval: [(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0),(0.0,1.0)] Test summary: outcome with 95% confidence: fail to reject h_0 two-sided p-value: 0.23810330555354436 (not significant) Details: Sample size: 4 statistic: 8.0 degrees of freedom: 6 residuals: [1.5,-0.5,-0.5,-0.5,-0.7071067811865475,0.7071067811865475,0.7071067811865475,-0.7071067811865475,-0.5,-0.5,-0.5,1.5] std. residuals: [2.0,-0.6666666666666666,-0.6666666666666666,-0.6666666666666666,-1.1547005383792517,1.1547005383792517,1.1547005383792517,-1.1547005383792517,-0.6666666666666666,-0.666666 6666666666,-0.6666666666666666,2.0]