I have a sample $x$ of size $n$ and $n$ is even. The $H_0$ is uniform distribution on the set $\{1,\dots,S\}$. Basically I do this:
table(x[seq.int(1, length(x), 2)], x[seq.int(2, length(x), 2)])
After that I would like to use Chi Square test for goodness fit, not for independence! More precisely, I had a sequence of random variables ${x_1,x_2,\ldots, x_n}$, now I have a sequence of random vectors ${(x_1,x_2), (x_3,x_4), \ldots, (x_{n-1}, x_n)}$ and I'd like to test $H_0^*$ about uniform distribution on set $\{1,\dots,S\}^2$.
I am a little bit confused by the help
page about chisq.test in R.
How can I use the table
, created in the code chunk above to handle Chi Square test for goodness fit, not(!) for independence?
Is it
a <- as.vector(table(x[seq.int(1, length(x), 2)], x[seq.int(2, length(x), 2)]))
chisq.test(a)
what I am looking for?
I would have thought the test against a Uniform distribution for a vector would be:
chisq.test(table(X), p=rep(1,S)/S ) # ... where S is length of the integer domain.
(Your Latex expressions may be pointing to something else. My Latex wetware is not as good as my R wetware.)