# Maximum Likelihood Estimate for a likelihood defined by parts

Suppose $$X_1$$, . . . , $$X_n$$ are i.i.d random variables having pdf

$$f(x\mid\theta)= \begin{cases} \frac{4}{\theta}-\frac{4x}{\theta^2} & \frac{\theta}{2} \lt x \lt \theta \\ \frac{4x}{\theta^2} & 0 \lt x \leq \frac{\theta}{2} \\ 0 & \text{otherwise} \end{cases}$$

where $$\theta\in(0,\infty)$$.

(a) Give a method of moments estimator of $$\theta$$

(b) For the case of $$n= 2$$, $$x_1= 10$$, and $$x_2= 4.5$$, give the maximum likelihood estimate of $$\theta$$.

My Attempt:

(a) I have that

$$\mathsf E(X)=\int_0^{\frac{\theta}{2}} \frac{4x^2}{\theta^2}dx+\int_{\frac{\theta}{2}}^{\theta} \frac{4x}{\theta}-\frac{4x^2}{\theta^2}dx=\frac{\theta}{2}$$

Hence

$$\mu_1'=\frac{\theta}{2}\Rightarrow \theta=2\mu_1'\Rightarrow \hat{\theta}_{MME} = 2\bar{x}$$

Is this a valid solution?

(b)

I'm not quite sure how to find the MLE since this is a piecewise function. The usual case I have dealt with is where

$$L(\theta\mid \vec{x})=f(\vec{x}\mid\theta)$$

and you just take the product of the individual densities.

I have in this case that the likelihood function is given by

$$L(\theta∣x_1,x_2)=\prod_{i=1}^2\left[\left(\frac{4}{\theta}−\frac{4x_i}{\theta^2}\right)I_{(\theta/2,\theta)}(x_i)+\frac{4x_i}{θ^2}I_{(0,\theta/2)}(x_i)\right]$$

One thing I notice is that since $$x_1= 10.0$$, and $$x_2= 4.5$$ it cannot be the case that $$x_1$$ and $$x_2$$ are both in $$\left(\frac{\theta}{2},\theta\right)$$. I also note that the only way $$x_1, x_2\in\left(0,\frac{\theta}{2}\right)$$ is if $$\theta\gt20$$. Could I somehow use these facts to get the likelihood on a case-by-case basis where either$$x_1,x_2\in\left(0,\frac{\theta}{2}\right)$$ or $$x_2\in\left(0,\frac{\theta}{2}\right)$$ $$x_1\in\left(\frac{\theta}{2},\theta\right)$$

My concern with going this route is that the probability that one of these two events occurs depends on $$\theta$$. Any hints to get me going in the right direction would be much appreciated.

• Question (b) is (trivially) answered by applying your result in (a). That the function is "piecewise" is just an incidental aspect of how it is described to you: the form of description has no intrinsic mathematical or statistical meaning and therefore does not affect how you solve the problem (apart from how you carry out the calculations). If the piecewise representation really bothers you, then just use $$f(x\mid\theta) =\max\left(0,\frac{1}{\theta}\left(2 - 4\sqrt{(x/\theta-1/2)^2}\right)\right).$$ – whuber Oct 10 '18 at 17:59
• Please do not cross post, and if you do, do link to the other post. I also see from your profile that you cross posted previous questions. This is against SE rules in general. – StubbornAtom Oct 10 '18 at 18:12
• I realized this question would be better suited for statistics.stackexchange. I didn't realize you weren't supposed to cross post. Should I delete the other? – Remy Oct 10 '18 at 18:16
• @whuber It's not clear to me how you obtained that function. – Remy Oct 10 '18 at 23:08
• @whuber (b) is asking for a maximum likelihood estimate and (a) was asking for the method of moments estimator. Did you perhaps misread the question? – Remy Oct 11 '18 at 3:48

The likelihood writes down as $$\prod_{i;\,x_i\le\theta/2} \frac{4x_i}{\theta^2} \prod_{i;\,\theta/2 that is $$4^n\theta^{-2n}\prod_{i;\,x_i\le \theta/2}x_i\prod_{i;\,\theta/2 Thus relabelling the observations as $$x_1, it is $$\begin{cases} 4^n\theta^{-2n}\prod_{i=1}^n x_i &\text{when }\theta/2>x_n\\ 4^n\theta^{-2n}\prod_{i=1}^{n-1} x_i (\theta-x_n) &\text{when }x_{n-1}<\theta/2\theta/2>x_2\vee x_n/2\\ 4^n\theta^{-2n} x_1\prod_{i=3}^n(\theta-x_i) &\text{when }x_2>\theta/2>x_1\vee x_n/2\\ 4^n\theta^{-2n}\prod_{i=1}^{n} (\theta-x_i) &\text{when }x_n/2<\theta/2 For $$n=2$$, this simplifies into $$\begin{cases} 4^2\theta^{-4}\prod_{i=1}^2 x_i &\text{when }\theta/2>x_2\\ 4^2\theta^{-4}x_1 (\theta-x_2) &\text{when }x_{1}\vee x_2/2<\theta/2 If $$x_2>2x_1$$ this further simplifies into $$\begin{cases} 4^2\theta^{-4}\prod_{i=1}^2 x_i &\text{when }\theta/2>x_2\\ 4^2\theta^{-4}x_1 (\theta-x_2) &\text{when }x_{2}<\theta<2x_2\\ \end{cases}$$ The first function of $$\theta$$ is maximised at the lower bound $$\theta=2 x_2$$ with value $$x_2^{-4}\prod_{i=1}^2 x_i=\frac{x_1}{x_2^3}$$ The second function of $$\theta$$ leads to the derivative $$\frac{-3}{\theta^4}+\frac{4x_2}{\theta^5}=\frac{4x_2-3\theta}{\theta^5}$$ which is positive iff $$\theta\le 4x_2/3$$. Hence the second function of $$\theta$$ is maximised at $$\theta=4x_2/3$$ which stands within the interval $$(x_2,2x_2)$$, with value $$4^2 (4x_2/3)^{-4} x_1 (x_2/3) = \frac{3^3 x_1}{4^2 x_2^3}$$ Since $$3^3/4^2=1.6875>1$$, the optimum of the function is achieved for $$\theta=4x_2/3$$. Which can be checked by plotting the likelihood function