10

I have reached up to

$$\frac{d\ln L}{d\mu}=\sum_{i=1}^n \frac{2(x_i-u)}{1+(x_i-u)^2}$$

Where $u$ is location parameter. And $L$ is likelihood function. I'm not getting how to proceed. Please help.

Michael Hardy
  • 7,094
  • 1
  • 20
  • 38
user89929
  • 151
  • 1
  • 1
  • 8

1 Answers1

15

Ok, Let us say the pdf for the cauchy is :

$f(x;\theta)=\frac{1}{\pi}\frac{1}{1+(x-\theta)^2}$ here $\theta$ is median, not mean since for Cauchy mean is undefined.

$$L(\theta;x)=\frac{1}{\pi}\frac{1}{1+(x_1-\theta)^2}\frac{1}{\pi}\frac{1}{1+(x_2-\theta)^2}\cdots\frac{1}{\pi}\frac{1}{1+(x_n-\theta)^2}\\=\frac{1}{\pi^n} \frac{1}{\prod[1+(x_i-\theta)^2]}$$

$$\ell(\theta;x)=-n\log\pi-\sum_{i=1}^n\log[1+(x_i-\theta)^2]$$

$$\frac{d\ell(\theta;x)}{d\theta}=\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2}$$

This is exactly what you got, except here $\theta$ is median, not mean. I suppose $u$ is median in your formula.

Next step, in order to find mle we need set $\frac{d\ell(\theta;x)}{d\theta} = \sum_{i=1}^n \frac{2(x_i-\theta)}{1+(x_i-\theta)^2}=0$

Now $\theta$ is your variable, and $x_is$ are known values, you need to solve equation $\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2}=0$

i.e. to solve $\frac{2(x_1-\theta)}{1+(x_1-\theta)^2}+\frac{2(x_2-\theta)}{1+(x_2-\theta)^2}+\cdots+\frac{2(x_n-\theta)}{1+(x_n-\theta)^2}=0$. It seems to solve this equation will be very difficult. Therefore, we need Newton-Raphson method.

I think a lot of calculus books talk about the method

The formula for Newton-Raphson method can be written as $$\hat{\theta^1}=\hat{\theta^0}-\frac{\ell'(\hat{\theta^0})}{\ell''(\hat{\theta^0})} \tag 1$$

$\hat{\theta^0}$ is your initial guess of $\theta$

$\ell'$ is the first derivative of log likelihood function.

$\ell''$ is the second derivative of log likelihood function.

From $\hat{\theta^0}$ you can get $\hat{\theta^1}$ then you put $\hat{\theta^1}$ to $(1)$ then you get $\hat{\theta^2}$ and put it to $(1)$ to get $\hat{\theta^3}$...continue this iterations until to there are no big changes between $\hat{\theta^n}$ and $\hat{\theta^{n-1}}$

The followings are R function I wrote to get mle for the Cauchy distribution.

mlecauchy=function(x,toler=.001){      #x is a vector here
startvalue=median(x)
n=length(x);
thetahatcurr=startvalue;
# Compute first deriviative of log likelihood
firstderivll=2*sum((x-thetahatcurr)/(1+(x-thetahatcurr)^2))
# Continue Newton’s method until the first derivative
# of the likelihood is within toler of 0.001
while(abs(firstderivll)>toler){
# Compute second derivative of log likelihood
 secondderivll=2*sum(((x-thetahatcurr)^2-1)/(1+(x-thetahatcurr)^2)^2);
# Newton’s method update of estimate of theta
thetahatnew=thetahatcurr-firstderivll/secondderivll;
thetahatcurr=thetahatnew;
# Compute first derivative of log likelihood
firstderivll=2*sum((x-thetahatcurr)/(1+(x-thetahatcurr)^2))
}
list(thetahat=thetahatcurr);
}

Now suppose your data are $x_1=1.94,x_2=0.59,x_3=-5.98,x_4=-0.08,x_5-0.77$

x<-c(-1.94,0.59,-5.98,-0.08,-0.77)
mlecauchy(x,0.0001)

Result:

#$thetahat
#[1] -0.5343968

We also can use R build in function to get mle.

optimize(function(theta) -sum(dcauchy(x, location=theta, log=TRUE)),  c(-100,100)) 

#we use negative sign here

Results:

#$minimum
#[1] -0.5343902

The result is almost the same as home-made codes.


Ok, as you required, let us do this by hand.

First we get an initial guess will be median of data $-5.98, -1.94, -0.77, -0.08, 0.59 $

The median is $-0.77$

Next we already know that $l'(\theta)=\frac{dl(\theta;x)}{d\theta}=\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2}$

and $$l''(\theta)=\frac{dl^2(\theta;x)}{d(\theta}=\frac{d(\sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2})}{d\theta}=2\sum_{i=1}^n\frac{(x_i-\theta)^2-1}{[1+(x_i-\theta)^2]^2}$$

Now we plug in the $\hat{\theta^0}$ i.e median to $l'(\theta)$ and $l''(\theta)$

i.e. replace $\theta$ with $\hat{\theta^0}$ i.e median i.e $-0.77$

\begin{align} \ell'(\theta) = {} & \sum_{i=1}^n\frac{2(x_i-\theta)}{1+(x_i-\theta)^2} \\[10pt] = {} &\frac{2[-5.98-(-0.77)]}{1+[(-5.98-(-0.77)^2]} + \frac{2[-1.94-(-0.77)]}{1+[(-1.94-(-0.77)^2]} + \frac{2[-0.77-(-0.77)]}{1+[(-0.77-(-0.77)^2]} \\[6pt] & {} +\frac{2[-0.08-(-0.77)]}{1+[(-0.08-(-0.77)^2]} +\frac{2[0.59-(-0.77)]}{1+[(0.59-(-0.77)^2]}\\[10pt] = {} & \text{??} \end{align}

Next plug in $x_1$ to $x_5$ and $-0.77$ to get $\ell''(\theta)$ then you can get $\hat{\theta^1}$

Ok, I have to stop here, it is too troublesome to calculate these values by hand.

Michael Hardy
  • 7,094
  • 1
  • 20
  • 38
Deep North
  • 4,527
  • 2
  • 18
  • 38
  • Your answer is right. I did the same way. But we can go this way only if we know the values in the sample. Does That mean there's no compact or generalized form for the MLE of location parameter of Cauchy distribution? – user89929 Sep 25 '15 at 15:27
  • I think generalized form for the MLE will be very complicated. I don't know if there is one. – Deep North Sep 25 '15 at 23:16
  • Check this out.. http://stats.stackexchange.com/questions/98971/mle-of-the-location-parameter-in-a-cauchy-distribution/98978?noredirect=1#comment317958_98978 There's a generalized form for it. But they have done some centering if Cauchy distribution, I don't know how! They've assumed the sample of size 2. I ain't getting why! Please help. – user89929 Sep 26 '15 at 21:05
  • They assumed $x_1=x; x_2=-x$ and they only got this two data points $x$ and $-x$, I think that is a very special case not a generalized form. – Deep North Sep 26 '15 at 23:21
  • Umm.. I still have some doubts. 1. What will be the initial guess for the theta hat? Will it be the median value from given sample? 2. l' and l" are derivatives with respect to theta or x? – user89929 Sep 27 '15 at 07:46
  • Median is the initial guess. $L'$ and $L''$ are derivatives with respect to $\theta$ – Deep North Sep 27 '15 at 08:01
  • Ohkay. I'm trying to solve it manually. What will be the initial guess in example you mentioned? Is it -0.08? – user89929 Sep 27 '15 at 09:42
  • For this data, -5.98, -1.94, -0.77, -0.08 , 0.59 median is -0.77. Not need to solve it manually. – Deep North Sep 27 '15 at 10:02
  • I typed in answer box by mistake. Please check it. – user89929 Sep 27 '15 at 10:18
  • I'm getting an equation after putting the median value (-0.77). So now I should go solving by putting values given in the sample. Like first putting x1 and then we will obtain thetahat1 then solving the same equation putting value of thetahat1 and x2 to obtain thetahat2? Is it what you meant? – user89929 Sep 27 '15 at 10:20
  • yes, but I don't know how many iterations you need to get to the convergence. You can check it by modifying the program. You had better not do it by hand. – Deep North Sep 27 '15 at 11:18
  • Yeah. But I've given that assignment to solve it manually. I did the same way you told. But by each iteration thetahat keeps increasing. And thetahat is coming out to be greater than all the sample values. Much greater. – user89929 Sep 27 '15 at 11:57
  • Hey, please solve my doubts. – user89929 Sep 30 '15 at 11:07
  • I'm getting this equation after putting the median value (-0.77). So now I should go solving by putting values given in the sample. Like first putting x1 and then we will obtain thetahat1 then solving the same equation putting value of thetahat1 and x2 to obtain thetahat2? Is it what you meant? – user89929 Sep 27 '15 at 10:16
  • Umm.. I still have some doubts. 1. What will be the initial guess for the theta hat? Will it be the median value from given sample? 2. l' and l" are derivatives with respect to theta or x? – user89929 Sep 27 '15 at 07:51
  • In the case of the Cauchy location (among many other MLE problems) this approach will find *a turning point* of the likelihood. But the Cauchy likelihood is in general multimodal... in general there's no guarantee you found the right peak (the one with the highest likelihood). – Glen_b Jun 25 '17 at 01:12