C Invert g(.,.,.,.) to calculate z(t,.) C C model with non-negativity constraint for investment xalp = z(t-1,1)**alpha(3) rhs = alpha(1)*psi(t,1) z(t,2) = rhs**(1/alpha(2)) prod = theta(t,1) * xalp + alpha(4)*z(t-1,1) z(t,1) = prod - z(t,2) z(t,3) = 0 z(t,5) = 0 if ( z(t,1) .lt. 0 ) then write(7,*) 'consumption too large' stop endif z(t,4) = z(t,1) - alpha(4)*z(t-1,1) if ( z(t,4) .lt. 0.) then z(t,1) = alpha(4)*z(t-1,1) z(t,2) = theta(t,1)*xalp umc = z(t,2)**alpha(2) z(t,4) = 0 z(t,3) = umc - rhs z(t,5) = 1 if ( z(t,3) .lt. 0) then write(*,*) 'negative lagr. multiplier' stop endif write(7,*) 'binding invest.constraint: mu= ', z(t,3) endif zlog(t,1)=log(z(t,1)) zlog(t,2)=log(z(t,2)) C calculate the phi to be predicted if (t.lt.140) goto 10 phi(t-1,1) = rhs * (alpha(3)*theta(t,1)*xalp / z(t-1,1) + $ alpha(4)*(1-z(t,3)) ) 10 continue