# Chi Squared Distribution for Maximum Likelihood

I'm beginning to work in bioinformatics and have come across some papers that utilize chi-squared distributions to make a maximum likelihood selection. Particularly in the area using 'amplicons'. I've reimplemented some algorithms in papers, but am unsure on how to use chi-squared to make a selection.

We have a matrix of data called our 'amplicon matrix', where columns are 'amplicons' and the data is a rna read, and a corresponding frequency matrix, containing the frequency of the items in the original matrix.

Here is a simplified example of the amplicon matrix as well as its corresponding frequency matrix. $$Amp = \begin{bmatrix} 'abab' &'cgcg' &'atat' \\ 'baba' &'gtgt' &'tata' \\ 'abab' &'gtgt' &'atta \end{bmatrix}$$ $$F = \begin{bmatrix} 2 & 2 & 1 \\ 1 & 1 & 1 \\ 0 & 0 & 1 \end{bmatrix}$$

I need to select an initial column by two methods. The first is just by selecting one at uniform random. The chi-squared is where I'm confused. I'm using this api and not totally sure of the degrees of freedom in the system. Is it just the rank of the frequency matrix? Additionally, how is a selection made based on the return value? Will it be guarenteed to correspond to a column index?

I apologize as it has been a while since I've taken any statistics, and will be refreshing my understanding in the fall.

Thank you.