# Find the Maximum Likelihood Estimator given two pdfs

From the book Introduction to Mathematical Statistics by Hogg, McKean and Craig (# 6.1.12):

Let $$X_1,X_2,\cdots,X_n$$ be a random sample from a distribution with one of two pdfs.

If $$\theta=1$$, then $$f(x;\theta=1)=\frac{1}{\sqrt{2\pi}}e^{-x^2/2},\,-\infty.

If $$\theta=2$$, then $$f(x;\theta=2)=\frac{1}{\pi(1+x^2)},\,-\infty. Find the mle of $$\theta$$.

My attempt: derive the first $$f$$ with respect to $$x$$ and set it to zero. That gives me $$x_{1}=0$$. Replacing in the first $$f$$, we get $$\sqrt{\frac{1}{2 \pi}}$$.
Working similarly with the second $$f$$ we get the value of $$\frac{1}{\pi}$$.
The former is greater, the the final answer is $$\theta = 1$$.

Is that right? If not, what would be the right procedure?

• You seem to be thinking right but doing it all wrong. You should be using $X_1, X_2, \ldots, X_n$. Remember, these samples came from one of the above two pdfs. If you had to decide which pdf it came from, how will you go about doing it? Jun 29, 2018 at 3:51
• You need to be calculating likelihoods in there somewhere. Jun 29, 2018 at 4:15
• You might want to add the self-study tag and read it's wiki. Jun 29, 2018 at 5:59
• @StubbornAtom Got it, I just added the self-study tag. I also noticed that you typed out the question, which I originally posted as a screenshot. Is that what I should always do? Jun 30, 2018 at 14:04
• stats.stackexchange.com/q/145014/119261 Feb 17, 2020 at 14:39

In this problem your unknown parameter $\theta$ only has two possible values, so you have a discrete optimisation where you just have to compare the likelihood at those two parameter values. (If you are taking derivatives of something in a discrete optimisation then you are going down the wrong track.) For an observed data vector $\mathbf{x}$ you have:

$$L_\mathbf{x}(\theta) = \begin{cases} (2 \pi)^{-n/2} \exp(-\tfrac{1}{2} \sum x_i^2) & & \text{for } \theta = 1, \\[6pt] \pi^{-n} / \prod (1+x_i^2) & & \text{for } \theta = 2. \\ \end{cases}$$

Since there are only two possible parameter values, you can find the maximising parameter value by looking at the sign of the difference in likelihood at these values. You have:

\begin{aligned} \Delta(\mathbf{x}) \equiv \text{sgn}(L_\mathbf{x}(1)-L_\mathbf{x}(2)) &= \text{sgn}\Bigg( (2 \pi)^{-n/2} \exp(-\tfrac{1}{2} \sum x_i^2) - \frac{1}{\pi^{n} \prod (1+x_i^2)} \Bigg) \\[6pt] &= \text{sgn}\Bigg( \exp(-\tfrac{1}{2} \sum x_i^2)\prod (1+x_i^2) - \Bigg( \frac{2}{\pi} \Bigg)^{n/2} \Bigg). \\[6pt] \end{aligned}

The maximum-likelihood-estimator (MLE) is:

$$\hat{\theta} = \begin{cases} 2 & & \text{if } \Delta(\mathbf{x}) = -1, \\[6pt] \{ 1,2 \} & & \text{if } \Delta(\mathbf{x}) = 0, \\[6pt] 1 & & \text{if } \Delta(\mathbf{x}) = 1. \\[6pt] \end{cases}$$

(In the case where $\Delta(\mathbf{x}) = 0$ the MLE is non-unique since the likelihood is the same at both parameter values.)

• Thank you. When you go form the first line to the second one, after multiplying both terms by $[\Pi (1+x_i)^2]^2$ I get $sgn((exp(-\frac{1}{2} \sum x_i^2))(\Pi (1+x_i^2))-(\frac{2}{\pi})^{n/2})$. Did I get something wrong? Jun 30, 2018 at 14:19
• Yes, that is correct - edited.
– Ben
Jul 1, 2018 at 2:01