# How to analyze observed vs expected when expected is just a proportion?

I did an experiment where I had subjects with a repertoire of possible responses to a stimulus. The stimulus presented was something in their repertoire. If they responded to the stimulus with a match of the stimulus I assigned them a value of 1 for match. If they responded to the stimulus without matching I assigned them a value of 0.

I'm interested in knowing if they matched the stimulus more often than expected by chance. I'm fairly certain I have to do a chi-square test for this but I'm uncertain how to go about my expected values. In most papers the expected value is the inverse of the mean repertoire across subjects. This makes sense in my study as well. What I don't know how to do is how to present my expected value in the correct way to do a chi-square, since my observed values are multiple values in a column and my expected value is just a proportion.

For example:

Observed Matches
1
0
0
0
0
1
0
0
0
0


Where the observed proportion of matches is 0.2. The mean repertoire for example is 10, meaning the expected proportion of matches is 0.1.

How do I perform a chi-square test (if this is the correct test) with these values?

• I hope your real sample is much larger than the 10 you give as an example. You would need a sample large enough that you could expect quite a few observations in match before it would be useful to test the idea that the rate of matches is greater than a chance of 0.1. Commented Mar 2, 2018 at 20:44

The test you need is a one sample z-test.

We seek to test $H_0:p=1/2 vs. H_1:p<1/2$, where $p$ is the proportion responding to the stimulus.

The test statistic is $Z = \frac{p-1/2}{\sqrt{0.5(1-0.5)/n}}$.

The distribution of $Z|H_0$ a standard normal, $N(0,1)$.

StatisticsLectures.com outlines the test further.

• Thanks! I've gone through setting up the function in R. With my data I end up getting a Z of 0 and a p of 0.5 for one-tailed and 1 for two-tailed. My data is one 1 followed by 15 zeros and the expected proportion is 1/12. Is there anything to worry about here with the Z of 0? Commented Mar 2, 2018 at 16:38
• Your alternate hypothesis does not correspond to the compliment of the null. Commented Mar 2, 2018 at 18:05
• I think you've subbed in $p=1/2$ at the top rather than $p=0.2$.
– user64106
Commented Mar 2, 2018 at 18:06
• If $H_{0}: p = 1/2$ then $H_{1}: p \ne 1/2$. Commented Mar 2, 2018 at 18:07
• Because $H_{1}$ = $^{c}H_{0}$ by definition. Commented Mar 2, 2018 at 20:47