# model 5 with reg for invest and imports
# Master 4 with product side in real terms
#  13 exogenous (not counting time)
#7 behavioral ratios for fi,pibg,indtax,ptax,piipcb,pipttf,pisav
#gdpD and cDBR=cD/gdpD exogenous
#vR,feR,gR,ngtppR  exogenous in constant dollars
checkdup y
fex time = time

#Gdp deflator
fex gdpD=gdp/gdpR

add vfR.sav
add viR.sav

f vR= vfR+viR
f v = vR*gdpR

add fiR.sav
f fi = fiR*gdpD
f gdpR=cR+vR+feR-fiR+gR
f gdp=gdpR*gdgD

#Behavior relatioship for imports
fex fiBR= fiR/(cR+vR+feR)
f fiR= fiBR*(cR+vR+feR)
# Gross domestic product
f gdpR = cR + vR + feR - fiR + gR

fex pibgBR= (gdp+fefaci-fifaci-ncca-nbtrp-nsd-niprf+npdivi-netint+npini-nwald+nbtrpp)/gdp
f pibg= pibgBR*gdp

fex indtaxBR=(nibtax-nsub)/gdp
f indtax= indtaxBR*gdp
f ptaxbase= pibg-indtax

fex ptaxBR= (pitax+nconsi)/ptaxbase
f ptax = ptaxBR*ptaxbase

#Govt trans exogenous real terms
fex ngtppR=ngtpp/gdpD
f ngtpp=ngtppR*gdpD

# Personal disposable income
f pidis = pibg-indtax-ptax+ngtpp

fex piipcbBR= piipcb/pidis
f piipcb = piipcbBR*pidis
fex pipttfBR= pipttf/pidis
f pipttf= pipttfBR*pidis
fex pisavBR= pisav/pidis
f pisav= pisavBR*pidis

f c= pidis-piipcb-pipttf-pisav

f cR=c/gdpD

check cR .2