Re: Computing derivative using finite differnce method
- From: John D'Errico <woodchips@xxxxxxxxxxxxxxxx>
- Date: Wed, 13 Jun 2007 12:03:39 -0400
In article <ef5a8af.-1@xxxxxxxxxxxxxxxxxxxxxxx>, "Abhijit Bhattacharya" <abhijit@xxxxxxxxxx> wrote:
I am working with MLECOV function.
Inorder to compute the asympotic covariance of the MLE of Weibull
distribution, I took the data set:
x=[1.8487;0.3761;0.75;3.053;1.3545;1.8802;1.57;1.7708;1.3592;3.0466;1.
7961;1.5319;0.5903;0.6288;0.6461;1.6560;1.7172;1.931;1.0509;1.6173;1.3
162;0.7705;1.8889;1.8889;4.1505];
The data is from a solved example of "Life testing and reliablity
estimation", S K Sinha & B. K .Kale.
The MLE for the parameters are
a=2.035, b=3.381
and the loglikehood function for the Weibull distribution fuction:
nloglf=25*(log(a)-log(b))+(a-1)*8.37031865 ...
-(x(1)^a+x(2)^a+x(3)^a+x(4)^a...
+x(5)^a+x(6)^a+x(7)^a+x(8)^a...
+x(9)^a+x(10)^a+x(11)^a+x(12)^a...
+x(13)^a+x(14)^a+x(15)^a...
+x(16)^a+x(17)^a+x(18)^a...
+x(19)^a+x(20)^a+x(21)^a...
+x(22)^a+x(23)^a+x(24)^a...
+x(25)^a)/b;
When I run function
acov=mlecov(params,x,'nloglf',@nloglf)
then we get
acov = NaN NaN
NaN NaN
with the warning
Warning: Cannot compute a cov matrix -- the computed Hessian is not
positive definite.
The closed form solution of the Hessian matrix given in the book is:
Hessain matrix = 28.02844 -6.108481
-6.108481 2.187003
This is however a postive definite matrix.
Are you positive that it is?
x=[1.8487;0.3761;0.75;3.053;1.3545;1.8802;1.57;1.7708;1.3592;3.0466;1.
7961;1.5319;0.5903;0.6288;0.6461;1.6560;1.7172;1.931;1.0509;1.6173;1.3
162;0.7705;1.8889;1.8889;4.1505];
nloglf=@(ab) 25*(log(ab(1))-log(ab(2)))+(ab(1)-1)*8.37031865 ...
-(x(1)^ab(1)+x(2)^ab(1)+x(3)^ab(1)+x(4)^ab(1)...
+x(5)^ab(1)+x(6)^ab(1)+x(7)^ab(1)+x(8)^ab(1)...
+x(9)^ab(1)+x(10)^ab(1)+x(11)^ab(1)+x(12)^ab(1)...
+x(13)^ab(1)+x(14)^ab(1)+x(15)^ab(1)...
+x(16)^ab(1)+x(17)^ab(1)+x(18)^ab(1)...
+x(19)^ab(1)+x(20)^ab(1)+x(21)^ab(1)...
+x(22)^ab(1)+x(23)^ab(1)+x(24)^ab(1)...
+x(25)^ab(1))/ab(2);
Using my own tools to compute the Hessian
matrix, I get:
[H,err] = hessian(nloglf,[2.035, 3.381])
H =
-2.0713e+09 6.8211e+07
6.8211e+07 -4.4928e+06
err =
0.0022387 0.00056996
0.00056996 0.00016566
It does not look at all like the one you gave.
And its clearly not positive definite. I will
buy into negative definite.
eig(H)
ans =
-2.0736e+09
-2.2441e+06
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13490&objectType=FILE#
HTH,
John
--
The best material model of a cat is another, or preferably the same, cat.
A. Rosenblueth, Philosophy of Science, 1945
Those who can't laugh at themselves leave the job to others.
Anonymous
.
- References:
- Computing derivative using finite differnce method
- From: Abhijit Bhattacharya
- Computing derivative using finite differnce method
- Prev by Date: fitting a surface to a point cloud
- Next by Date: Re: plot poles
- Previous by thread: Computing derivative using finite differnce method
- Next by thread: Multiple left-hand sides
- Index(es):
Relevant Pages
|