I have got data from a sample that is thought to be uniformly distributed. The data is shown below:
My question is for what range of values for y, is the data not consistent with the distribution at the 5% significant level.
This is what I have done so far:
Then I did:
$$ \chi^2 = \frac{(y-6)^2}{6} + \frac{(16-y)^2}{12} = \frac{3y^2-56y+328}{12} $$
$$ v=20 $$
critical value from data table = 10.85
therefore
$$ \chi^2 \leq 10.85 $$
Thus
$$ \frac{3y^2-56y+328}{12} = 10.85 $$ $$ 4.73 \leq y \leq 13.93 $$
Is this correct?


Assuming a discrete uniform (implied by the ranges in the bins), we see that under the null hypothesis that $X \mid H_0 \sim \operatorname{DiscreteUniform}(1, 20)$, the expected number of observations in the range $\{1, \ldots, 8\}$ in a sample size of $n = 40$ should be $$\frac{8}{20} \cdot 40 = 16,$$ not $12$ as you have in your table. Similarly, the expected number of observations in $\{9, \ldots, 12\}$ is $8$, and the expected number of observations in $\{13, \ldots, 20\}$ is $16$. Indeed, the sum of your observed frequencies is $$12 + y + (28-y) = 40,$$ yet your expected frequencies sum only to $12 + 6 + 12 = 30$.
The result of such a test would give an approximate $p$-value. You could alternatively construct a test based on a likelihood ratio.