I currently have an output function that roughly follows a $\chi^2$ distribution for random data with one degree of freedom. As a cursory analysis that has since proven mathematically unrigorous, this appeared to be bounded by $[0,1]$ on the x-axis, with a mode of 0, and a steep falloff such that my PDF offers highly significant results after a value of roughly 0.1 on said x-axis.
My input data set is derived from the normalized redudancy of categorical bins of data. My null hypothesis is that the data coming in for two arbitrarily selected datasets are independent (that is, $p(x,y) = p(x)\ p(y)$ for all $x \in X$ and $y \in Y$ ). My test statistic is the measure from which this test for independence deviates from the observed data. At present, the closed mathematical model for my test statistic remains undevised.
Unsurprisingly because of this, after slogging through the documentation for various tools to provide a statistical measure of significance in the context of this distribution, including SciPy (the framework I am using for other tests, as all of this work is currently in Python), I am unable to come to a good, working definition for my test statistic and significance thereof. Even if I do, I am unsure how to implement it effectively, as tools like SciPy are sparsely and inadequately documented. I understand, for example, how to integrate an arbitrary distribution, but not how to construct one of my devising in line with these requirements.
To this end, I've played with the input parameters for
scipy.stats.chi2 and can get a non-robust, 0th level approximation that roughly aligns with my observed output. However, I am unable to see how my model aligns with the constructs provided by SciPy, as I fail to grasp SciPy's object model in the context of the statistical and mathematical definitions of, for example, a $\chi^2$ distribution. I am also not cognizant on the correct terminology to further specify this question, and as evidenced, I have altered its title and content severely because of this.
So, as a further specified question, this becomes two pieces:
Given these requirements, how might I construct a good, statistically rigorous test statistic and rejection criteria for null? This will be used in an automated manner, so showing the closed form for the approach is greatly appreciated, albeit not required, to solve this problem.
How might I implement this in Python? Because the documentation is so tersely insufficient, links to further sourcing and crisp definitions of all constants, variables, and non-obvious operators (to a high school graduate with a fundamental course in probabilistic statistics) would be greatly appreciated.