matlab求fisher信息,matlab求解fisher 信息矩阵

现在要求置信区间,需要用fisher information matrix,其中,如果有三个变量,其表达形式如图所示,其中分子的那个符号是极大似然函数。

现在如何求得这个矩阵

本来写了一个m文件,用的是符号函数,但是现在看来对符号函数理解有误

但是现在令f输出,输出f = 0?而不是一个表达式

%This scripits try to find out the FIM-fisher information matrix

syms a b c d e

global S1o_f2 S2o_f2 S3o_f2 S4o_f2 S5o_f2 S6o_f2;    %这些数据通过另一个文件读入

n1 = length(S1o_f2);

n2 = length(S2o_f2);

n3 = length(S3o_f2);

n4 = length(S4o_f2);

n5 = length(S5o_f2);

n6 = length(S6o_f2);

f1 =0;f2 =0;f3 =0;f4 =0;f5 =0;f6 =0;

T1 = 353.15;RH1 = 80; I1 = 60;

T2 = 343.15;RH2 = 95; I2 = 40;

T3 = 328.15;RH3 = 80; I3 = 40;

T4 = 353.15;RH4 = 80; I4 = 20;

T5 = 343.15;RH5 = 95; I5 = 60;

T6 = 328.15;RH6 = 95; I6 = 20;

for i = 1:n1

f1 = f1+(log(e)+(e-1).*log(S1o_f2(i,1))-e*(a+b/T1+c/RH1+d*log(I1))-(S1o_f2(i,1).^e)*exp(-e*(a+b/T1+c/RH1+d*log(I1)))); %后来发现可

%以用矩阵计算,但是没有改

end

for i = 1:n2

f2 = f2+(log(e)+(e-1).*log(S2o_f2(i,1))-e*(a+b/T2+c/RH2+d*log(I2))-(S2o_f2(i,1).^e)*exp(-e*(a+b/T2+c/RH2+d*log(I2))));

end

for i = 1:n3

f3 = f3+(log(e)+(e-1).*log(S3o_f2(i,1))-e*(a+b/T3+c/RH3+d*log(I3))-(S3o_f2(i,1).^e)*exp(-e*(a+b/T3+c/RH3+d*log(I3))));

end

for i = 1:n4

f4 = f4+(log(e)+(e-1).*log(S4o_f2(i,1))-e*(a+b/T4+c/RH4+d*log(I4))-(S4o_f2(i,1).^e)*exp(-e*(a+b/T4+c/RH4+d*log(I4))));

end

for i = 1:n5

f5 = f5+(log(e)+(e-1).*log(S5o_f2(i,1))-e*(a+b/T5+c/RH5+d*log(I5))-(S5o_f2(i,1).^e)*exp(-e*(a+b/T5+c/RH5+d*log(I5))));

end

for i = 1:n6

f6 = f6+(log(e)+(e-1).*log(S6o_f2(i,1))-e*(a+b/T6+c/RH6+d*log(I6))-(S6o_f2(i,1).^e)*exp(-e*(a+b/T6+c/RH6+d*log(I6))));

end

f = -(f1+f2+f3+f4+f5+f6)

dfd1 = diff(f,a);

dfd2 = diff(f,b);

dfd3 = diff(f,c);

dfd4 = diff(f,d);

dfd5 = diff(f,e);

dfd1d1 = diff(dfd1,a);

dfd1d2 = diff(dfd1,b);

dfd1d3 = diff(dfd1,c);

dfd1d4 = diff(dfd1,d);

dfd1d5 = diff(dfd1,e);

dfd2d2 = diff(dfd2,b);

dfd2d3 = diff(dfd2,c);

dfd2d4 = diff(dfd2,d);

dfd2d5 = diff(dfd2,e);

dfd3d3 = diff(dfd3,c);

dfd3d4 = diff(dfd3,d);

dfd3d5 = diff(dfd3,e);

dfd4d4 = diff(dfd4,d);

dfd4d5 = diff(dfd4,e);

dfd5d5 = diff(dfd5,e);

F = zeros(5,5);

F(1,1) = subs(dfd1d1,[a b c d e],O);   %O是一个(1,5)的数值矩阵

F(1,2) = subs(dfd1d2,[a b c d e],O);

F(1,3) = subs(dfd1d3,[a b c d e],O);

F(1,4) = subs(dfd1d4,[a b c d e],O);

F(1,5) = subs(dfd1d5,[a b c d e],O);

F(2,2) = subs(dfd2d2,[a b c d e],O);

F(2,3) = subs(dfd2d3,[a b c d e],O);

F(2,4) = subs(dfd2d4,[a b c d e],O);

F(2,5) = subs(dfd2d5,[a b c d e],O);

F(3,3) = subs(dfd3d3,[a b c d e],O);

F(3,4) = subs(dfd3d4,[a b c d e],O);

F(3,5) = subs(dfd3d5,[a b c d e],O);

F(4,4) = subs(dfd4d4,[a b c d e],O);

F(4,5) = subs(dfd4d5,[a b c d e],O);

F(5,5) = subs(dfd5d5,[a b c d e],O);

F(2,1) = F(1,2);

F(3,1) = F(1,3);

F(3,2) = F(2,3);

F(4,1) = F(1,4);

F(4,2) = F(2,4);

F(4,3) = F(3,4);

F(5,1) = F(1,5);

F(5,2) = F(2,5);

F(5,3) = F(3,5);

F(5,4) = F(4,5);

fisher informationg matrix.jpg

你可能感兴趣的:(matlab求fisher信息)