MLE for $\theta>0$ with $(X_1,\dots,X_n)\sim \mathcal N(\theta, 2\theta)$

108 Views Asked by At

I want to determine the MLE for $\theta$ given a sample $(X_1,\dots, X_n)\sim \mathcal N(\theta, 2\theta)$. I know that the likelihood function is $$f(X;\theta) = \frac{1}{2\sqrt\theta}\prod_{i=1}^n\exp\left(-\frac{(X_i-\theta)^2}{4\theta}\right).$$ The log likelihood function is therefore $$L(X;\theta) = -\log(2\sqrt\theta) -\sum_{i=1}^n \frac{(X_i-\theta)^2}{4\theta}.$$ If we differentiate and solve $ \frac{\partial L}{\partial \theta} = -\frac{1}{2\theta} - \sum_{i=1}^n \left[\frac{X_i^2}{4\theta^2}+\frac{1}{4}\right]\\$ we get \begin{align*} 0 &= -\frac{1}{2\theta} -\sum_{i=1}^n \left[\frac{X_i^2}{4\theta^2}+\frac 1 4\right]\\ \iff 0 &= 2\theta - \sum_{i=1}^n[X_i^2+\theta^2]\\ \iff 0 &= -n\theta^2 + 2\theta - \sum_{i=1}^n X_i^2\\ \iff 0 &= \theta^2 -\frac{2}{n}\theta + \frac{1}{n}\sum_{i=1}^n X_i^2 \end{align*} Which is $0$ if $\theta_{1,2} = \frac 1 n \pm\sqrt{\frac 1 {n^2} - \frac{1}{n}\sum_{i=1}^n X_i^2}$. But this is highly implausible because the square root term is most likely negative. From experimentations in Python I can say that $$\theta^\ast = \frac 1 n + \sqrt{\frac{1}{n^2} + \left(\frac{1}{n}\sum_{i=1}^n X_i\right)}$$ seems to work quite well. What am I doing wrong?