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