In general, this task to investigate if certain images are viewed first significantly more often than the rest can be approximated by a one-way $\chi^2$ test here. Our expected counts would be $4$ ($\frac{40}{10}$) if we assume that every image is equally likely to be picked. Then a $\chi^2$ test is fine provided we simulated the $p$-values because our expected counts are lower than $5$. So in terms of R we do something like this:
> S=c(5,4,11,2,0,5,6,0,3,4)
> set.seed(321)
> chisq.test(S, simulate.p.value=TRUE, B=2^17)
Chi-squared test for given probabilities with simulated p-value (based
on 131072 replicates)
data: S
X-squared = 23, df = NA, p-value = 0.007164
Suggesting our $p$-value is below 1% so it is quite unlikely the observed counts came from a uniform distribution. One can use other test too (e.g. to run a multinomial test using XNomial::xmonte
) but those give similar results.
> set.seed(321)
> XNomial::xmonte(S, rep(4,10), ntrials = 2^17, statName="LLR")
P value (LLR) = 0.002662659 ± 0.0001423
> set.seed(321)
> # Let's do a chi-squared test with this function too.
> XNomial::xmonte(S, rep(4,10), ntrials = 2^17, statName="Chisq")
P value (Chisq) = 0.007049561 ± 0.0002311
Of course if we had another null hypothesis about our expected counts we could use that instead and get the relevant results. Finally, let's note that that exact tests in this use-case would take too long as we have hundreds of millions of possible table combinations; I suppose they can be done if we are very eager though! :)