A quiz asks me to calculate the likelihood ratio for 50 heads out of 100 coin tosses. I understand that a coin can be either fair or not fair and that a fair coin has a probability of 0.5 for heads.
The quiz does not give me the probability of the unfair coin so how can I be expected to calculate the likelihood ratio? Is there a convention I should be using?

[Update] The quiz also asked me for the case of 5 heads out of 10 tosses. In this case I used p=0.4 as the alternative hypothesis and correctly calculated 1.23 as a ratio. When I try this technique for 50 out of 100 I get 1.02 but this is marked as incorrect.

My efforts with the code in the test are as follows

n<-100 #set total trials
x<-50  #set successes
H0 <- 0.5 #specify one hypothesis you want to compare with the likihood ratio
H1 <- 0.49 #specify another hypothesis you want to compare with the likihood ratio (you can use 1/20, or 0.05)
R1<-dbinom(x,n,H0)/dbinom(x,n,H1) #Returns the likelihood ratio of H0 over H1

Which outputs 1.02 for R1 at 2 decimal places.

I am trying to understand why this is wrong. Could the quiz be wrong? The comment in the code that I can use 0.05 as H1 is especially confusing.

  • $\begingroup$ Presumably the intent is not that you choose a specific value but that you use an algebraic symbol. $\endgroup$
    – Glen_b
    Commented Dec 29, 2021 at 10:51
  • 1
    $\begingroup$ In your code, H1 is $0.49$ rather than the $0.4$ you state: perhaps that's why your answer was marked incorrect. As remarked in the answers, it's more informative to use a spectrum of possible alternatives, such as setting H1 <- seq(0, 0.50, by=0.01). This will produce 51 ratios that you can easily plot via plot(H1, R1, log="y"). $\endgroup$
    – whuber
    Commented Dec 30, 2021 at 20:44
  • $\begingroup$ When the quiz has n = 10 I use H1= 0.4 When the quiz has n = 100 I use H1=0.49 The answer is scored wrong in the case that n = 100. Why? $\endgroup$
    – Kirsten
    Commented Dec 30, 2021 at 20:47
  • 1
    $\begingroup$ We can't tell you anything about the quiz scoring: we don't have a copy of the quiz or its scoring rubric. This is a question to raise with your instructor. $\endgroup$
    – whuber
    Commented Dec 30, 2021 at 20:51
  • $\begingroup$ "A quiz asks me to calculate the likelihood ratio for 50 heads out of 100 coin tosses" It would also help if you quote the quiz exactly. $\endgroup$ Commented Dec 30, 2021 at 22:42

3 Answers 3


You can compute the likelihood ratio as a function of $p$

$$\Lambda_{LR} = \frac{\mathcal{L}(p\vert \text{H} = 50, \text{T} = 50)}{ \mathcal{L}(0.5\vert \text{H} = 50, \text{T} = 50)} = 2^{100} p^{50} (1-p)^{50}$$

ratio as function of p

In the context of a likelihood ratio test where the alternative hypothesis is a composite hypothesis you choose the value of $p$ for which the likelihood of the alternative hypothesis is maximized. So then the likelihood ratio, in the case of 50 tails and 50 heads is equal to 1.

  • $\begingroup$ I am so confused. Looking at the chart that would make p = 0.5 which is the same as that of the null hypothesis $\endgroup$
    – Kirsten
    Commented Dec 29, 2021 at 21:09
  • $\begingroup$ @Kirsten all of the region from $0$ to $1$ except the point $p=0.5$ is the alternative hypothesis. $\endgroup$ Commented Dec 29, 2021 at 22:43
  • $\begingroup$ I updated the question to better explain my confusion. Perhaps it is a faulty quiz? $\endgroup$
    – Kirsten
    Commented Dec 30, 2021 at 20:36

It depends what the null and alternative hypotheses are. I assume the null is that the coin is fair ($Pr($heads$)= 0.5$), which is a simple null.

If the alternative is simple too, just write it generically as $Pr($heads$)=p_1\neq 0.5$ and proceed with constructing the likelihood ratio working with $p_1$.

If the alternative is composite of the form $Pr($heads$)\neq 0.5$, then you can proceed by setting up the generalized likelihood ratio, suping over the parameter space $[0,1]$. In your case, under 50 heads of 100 tosses, the likelihood is maximized at $Pr($heads$)= 0.5$, so the ratio of suped likelihoods must be 1 (or the generalized likelihood ratio test statistic, which logs this ratio, would be 0).


Your question is from the coursera course "Improving your statistical inferences" by Daniel Lakens.

In the instruction PDF on the previous lecture there is more information, which is missing here:

Earlier we mentioned that with increasing sample sizes, we had collected stronger relative
evidence. Let’s say we would want to compare L(θ = 0.4) with L(θ = 0.5).
Q4: What is the likelihood ratio for 5 out of 10 heads?
Q5: What is the likelihood ratio for 50 out of 100 heads?
Q6: What is the likelihood ratio for 500 out of 1000 heads? 

That means, you need to calculate the likelihood ratio between L(θ = 0.4)/L(θ = 0.5) for the case of observing 5/10, 50/100 or 500/1000 heads. The likelihood ratios are therefor 1.23, 7.7 and 731784961.36. It is indeed not well formulated in the quiz, I was also confused at first as to what I had to do.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.