Checks if a share is really different from what you guessed.
prop.test(x, n, p)
Key idea
A proportion test checks whether an observed rate (a share) differs from a guessed value. (e.g. p0 = 0.50)
Example: is a click rate different from 50%? (e.g. 120 of 200 = 0.60)
A small p-value (the chance of luck alone giving this) is evidence the true share is not the guessed value. (e.g. p = 0.004)
It also returns a confidence interval — a plausible range for the true share. (e.g. (0.53, 0.67))
Larger samples make small differences from the guess easier to detect. (e.g. n = 5000)
Definition
z=np0(1−p0)p^−p0
p^
the observed sample proportion
p0
the proportion you are testing against
n
the sample size
z
the test statistic
In plain words
You think a coin is fair, but 60 of 100 flips were heads. Is the coin really unfair, or was that just luck? This tells you.
Where you'd use it
You flip a coin 100 times and get 60 heads. prop.test(60, 100, 0.5) gives a p-value around 0.05, right on the edge — weak evidence the coin might be unfair rather than just lucky.
An ad is expected to be clicked 10% of the time, but 150 of 1000 viewers clicked. Testing prop.test(150, 1000, 0.1) yields a tiny p-value, strong evidence the real click rate beats 10%.
You suspect more than 1 in 10 students are left-handed and find 18 of 100. prop.test(18, 100, 0.1) tells you whether 18% is a genuine difference from 10% or could be ordinary sampling luck.
Worked example 13
You expected p = 0.5 but got 60 heads in 100 flips. The test says how surprising that is (p-value ≈ 0.05).