# Given the density of X and a sample size of 4 with yielded observations 1, 2.5, 3.5, 4 calculate the maximum likelihood estimator

I'm currently just learning about Maximum likelihood estimators and I'm a bit stuck on how I should answer this question.

So far I know that for the function to hold, the observation 4 should be <= 2*theta. and that theta>=2 as a result right?

But then I'm not sure how to use it to find the estimator.

I set the Likelihood function as the following

I know I'm supposed to differentiate the log likelihood functions with respect to theta but I get -1/theta=0. Is there no mle estimator or am I missing something?

I'm not sure, but I think it's like finding the MLE for a uniform distribution in that you need to account for the fact that the likelihood of $\theta|\textbf{X}$ equals zero if $2\theta$ is less than the maximum of the sample. Then, I think the likelihood (written with indicator functions rather than piecewise) is written as follows:

$L(\theta|\textbf{x})=[(\frac{3}{4\theta})^{n_1}(\frac{1}{4\theta})^{n-n_1}]I(x_{(1)}\geq0)I(x_{(n)}\leq2\theta)$

where $n_1$ is the number of observations between $0$ and $\theta$.

If that's right, then I don't think you need to differentiate. You just recognize the function is a decreasing function of $\theta$ over $[\frac{x_{(n)}}{2},\infty)$ and equal to zero for values less than $\frac{x_{(n)}}{2}$. The MLE is therefore $\frac{x_{(n)}}{2}$

• Thanks this really helped me out. This actually helped me out answer another question of mine!
– user42668
May 3, 2014 at 13:17

I don't think the answer is $\hat{\theta} = 2$. However, user44107 is correct: the function here is not everywhere continuous, so it doesn't make sense to differentiate. Try to make its graph for different $\theta$. The OP expression of likelihood is incorrect, BTW. user44107 has the correct expression.

• Sure it makes sense to differentiate: this log likelihood is differentiable within the interior of the region where it is defined. But, as all Calculus students are admonished--because this is so easily forgotten in the excitement of learning about the power of differentiation--extrema can occur at the boundaries of domains of functions, not just at the critical points, and so the boundary must be tested too.
– whuber
May 2, 2014 at 16:40