Error in FIML estimation

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

ming-ming
Posts: 9
Joined: Mon Jan 09, 2012 8:22 pm

Error in FIML estimation

Postby ming-ming » Thu Feb 16, 2012 10:10 pm

Hello,
I am trying to do a system estimation using FIML. However, the code I wrote didn't work. I have checked the possible error while entering the equations but found none. I specified thousands of initial values through loops but none of them worked either (I specified a very large number for the errors allowed before halting in the run dialogue window). I have attached the code as well as the data set I used. Could anybody help me out? Many Thanks!

Code: Select all

cd C:\Users\Desktop\research\unnormalized wfopen(type=excel) "raw_data.xls" pagestruct(freq=a,start=1952,end=1998) output(t,o) MLE_case_1 poff mode quiet genr time = @trend+1 genr lshare = log(lincome/pgdp) genr kshare = log(kincome/pgdp) genr ly =log(rpgdp) genr ll = log(linput) genr lk = log(kpreal) genr lh = log(H) genr lyl = ly-ll system sys_mle sys_mle.append ly = -1/c(7)*log(c(1)*(exp(c(2)/c(3)*(time^c(3)-1))*(linput-1/c(4)*(h-linput)^((c(5)-1)/c(5))*(linput(1)-linput*(1-c(6)))^(1/c(5))))^(-c(7))+c(8)*(exp(c(9)/c(10)*(time^c(10)-1))*kpreal)^(-c(7))) sys_mle.append kshare = log(c(8))+c(7)*(ly-lk-c(9)/c(10)*(time^c(10)-1)) sys_mle.append log(1+r(1)) = -log(c(1)*(rpgdp/(exp(c(2)/c(3)*(time^c(3)-1)))/(linput-1/c(4)*(h-linput)^((c(5)-1)/c(5))*(linput(1)-linput*(1-c(6)))^(1/c(5))))^(1+c(7))*exp(c(2)/c(3)*(time^c(3)-1))/(c(4)*(h-linput)^((1-c(5))/c(5))*(linput(1)-linput*(1-c(6)))^((c(5)-1)/c(5))))+log(c(1)*(rpgdp(1)/(exp(c(2)/c(3)*(time(1)^c(3)-1)))/(linput(1)-1/c(4)*(h(1)-linput(1))^((c(5)-1)/c(5))*(linput(2)-linput(1)*(1-c(6)))^(1/c(5))))^(1+c(7))*exp(c(2)/c(3)*(time(1)^c(3)-1))-w(1)/pgdpdef(1)+(1-c(6))*(c(1)*(rpgdp(1)/(exp(c(2)/c(3)*(time(1)^c(3)-1)))/(linput(1)-1/c(4)*(h(1)-linput(1))^((c(5)-1)/c(5))*(linput(2)-linput(1)*(1-c(6)))^(1/c(5))))^(1+c(7))*exp(c(2)/c(3)*(time(1)^c(3)-1))/(c(4)*(h(1)-linput(1))^((1-c(5))/c(5))*(linput(2)-linput(1)*(1-c(6)))^((c(5)-1)/c(5))))) scalar ind = 0 scalar m = 5 !n2 = m !n3 = m !n4 = m !n5 = m !n6 = m !n7 = m !n9 = m !n10 = m scalar n = !n2*!n3*!n4*!n5*!n6*!n7*!n9*!n10 vector(n) logl for !i2 = 1 to !n2 for !i3 = 1 to !n3 for !i4 = 1 to !n4 for !i5 = 1 to !n5 for !i6 = 1 to !n6 for !i7 = 1 to !n7 for !i9 = 1 to !n9 for !i10 = 1 to !n10 scalar ind = ind+1 c(1) = 0.3 c(2) = 0.01+(!i2-1)*0.03 c(3) = -0.1+(!i3-1)*0.5 c(4) = 0.1+(!i4-1)*1.5 c(5) = 0.1+(!i5-1)*0.15 c(6) = 0.1+(!i6-1)*0.1 c(7) = 0.25+(!i7-1)*0.1 c(8) = 0.8 c(9) = 0.01+(!i9-1)*0.03 c(10) = -0.1+(!i10-1)*0.5 do sys_mle.fiml(m=100000,c=0.00001) logl(ind) = sys_mle.@logl next next next next next next next next scalar max_logl = @max(logl) wfsave mle_case_1
Attachments
raw_data.xls
(28 KiB) Downloaded 268 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Error in FIML estimation

Postby EViews Gareth » Thu Feb 16, 2012 10:41 pm

I haven't looked in great detail, but at some point you have:

Code: Select all

(H-LINPUT)^((C(5)-1)/C(5))
C(5) starts at 0.1, and you raise it by 0.15 each time through your loops. Your loops go up to 5. Thus C(5) is always less than 1, which means that C(5)-1 is negative, and then you raise it to a power that is less than 1. You can't raise a negative number to a power less than 1.

There may be other errors, but that's one that jumped out at me.

ming-ming
Posts: 9
Joined: Mon Jan 09, 2012 8:22 pm

Re: Error in FIML estimation

Postby ming-ming » Thu Feb 16, 2012 11:36 pm

Hi Gareth,

Thank you for your response. I checked the code again. Take the following one as an example

Code: Select all

(H-LINPUT)^((C(5)-1)/C(5))
The base (H-LINPUT) is always positive and the power ((C(5)-1)/C(5)), as you mentioned, is negative. But I did not "raise a negative number to a power less than 1". Could you clarify a little bit? Thanks.

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Error in FIML estimation

Postby trubador » Fri Feb 17, 2012 3:08 am

As usual, this is not a software issue. You should always carefully check the equations and specifications in such complex models. In the first equation, for instance, you have the following specification that leads to negative values:

Code: Select all

linput - (1/c(4) * (h-linput)^((c(5)-1) / c(5))*(linput(1)-linput*(1-c(6)))^(1 / c(5)))
The values generated by the RHS of minus operator are higher than that of the LHS (i.e. the values in your linput variable)...

ming-ming
Posts: 9
Joined: Mon Jan 09, 2012 8:22 pm

Re: Error in FIML estimation

Postby ming-ming » Fri Feb 17, 2012 10:14 pm

Thank you for your response. That is indeed an issue.

After I fixed that issue by choosing another group of initial values, which guarantees all positive bases before raised to any power, a similar error message occurs, i.e., "no valid observation..." or "near singular matrix..." Any suggestion on this issue?

Many thanks!

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Error in FIML estimation

Postby trubador » Mon Feb 20, 2012 12:45 am

It is hard to tell without seeing the final version of your specification along with the workfile. However, it still seems to be an initialization problem. The specification of the model makes it difficult to find a feasible set of starting values for the parameters. It would be helpful, if you could gather some information on the parameter domain from similar studies...


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests