楼主: xuehe
11406 20

A STANDARD CGE GAMS CODE FILE ZIP [推广有奖]

贵宾

学术权威

90%

还不是VIP/贵宾

-

威望
8
论坛币
571369 个
通用积分
435.3190
学术水平
365 点
热心指数
358 点
信用等级
202 点
经验
353637 点
帖子
4354
精华
9
在线时间
2623 小时
注册时间
2004-12-31
最后登录
2024-5-6

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
99685.zip (81.01 KB, 需要: 300 个论坛币) 本附件包括:
  • clean.bat
  • codeupdates.txt
  • diagnostics.inc
  • mod101.gms
  • rall.bat
  • readme.txt
  • repbase.inc
  • reploop.inc
  • repperc.inc
  • repsetup.inc
  • repsum.inc
  • rmod.bat
  • rsim.bat
  • samagg.gms
  • sambal.inc
  • sim101.gms
  • swazilan.dat
  • test.dat
  • varinit.inc
  • varlow.inc
  • zimbabwe.dat

[此贴子已经被作者于2008-1-22 21:18:29编辑过]

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Standard stand file gams STAN CGE Standard file zip gams

沙发
xuehe 发表于 2007-3-16 19:24:00 |只看作者 |坛友微信交流群

请不了解勿扰,拜托了。

使用道具

藤椅
piaopiao85 发表于 2007-3-18 01:30:00 |只看作者 |坛友微信交流群

能否详细介绍,毕竟太贵了

我很感兴趣,最近也在做这块的介绍。能否详细介绍,毕竟太贵了。至少把代码的头部注释贴出来吧。不然这么贵会有人买么

使用道具

板凳
xuehe 发表于 2007-3-18 23:46:00 |只看作者 |坛友微信交流群
在你学习CGE必须学习的,如果你把这个理解了,大概就可以做各种CGE,一中国较早搞CGE的学者说的。

使用道具

报纸
zhengzn 发表于 2007-3-19 15:32:00 |只看作者 |坛友微信交流群

使用道具

地板
zhengzn 发表于 2007-3-19 15:32:00 |只看作者 |坛友微信交流群

Appendix. Core GAMS code for standard CGE model

SETS

AC global set for model accounts-aggregated microsam accounts

A(AC) activities

ACES(A) activities with CES fn at top of technology nest

ALEO(A) activities with Leontief fn at top of technology nest

C(AC) commodities

CD(C) commodities with domestic sales of output

CDN(C) commodities without domestic sales of output

CE(C) exported commodities

CEN(C) non-exported commodities

CM(C) imported commodities

CMN(C) non-imported commodities

CX(C) commodities with output

F(AC) factors

INS(AC) institutions

INSD(INS) domestic institutions

INSDNG(INSD) domestic non-government institutions

H(INSDNG) households

PARAMETERS

*Parameters other than tax rates

alphaa(A) shift parameter for top level CES function

alphaac(C) shift parameter for domestic commodity aggregation fn

alphaq(C) shift parameter for Armington function

alphat(C) shift parameter for CET function

alphava(A) shift parameter for CES activity production function

betah(A,C,H) marg shr of hhd cons on home com c from act a

betam(C,H) marg share of hhd cons on marketed commodity c

cwts(C) consumer price index weights

deltaa(A) share parameter for top level CES function

deltaac(A,C) share parameter for domestic commodity aggregation fn

deltaq(C) share parameter for Armington function

deltat(C) share parameter for CET function

deltava(F,A) share parameter for CES activity production function

dwts(C) domestic sales price weights

gammah(A,C,H) per-cap subsist cons for hhd h on home com c fr act a

gammam(C,H) per-cap subsist cons of market com c for hhd h

ica(C,A) intermediate input c per unit of aggregate intermediate

inta(A) aggregate intermediate input coefficient

iva(A) aggregate value added coefficient

icd(C,CP) trade input of c per unit of com cp produced & sold dom'ly

ice(C,CP) trade input of c per unit of com cp exported

icm(C,CP) trade input of c per unit of com cp imported

mps01(INS) 0-1 par for potential flexing of savings rates

mpsbar(INS) marg prop to save for dom non-gov inst ins (exog part)

qdst(C) inventory investment by sector of origin

qbarg(C) exogenous (unscaled) government demand

qbarinv(C) exogenous (unscaled) investment demand

rhoa(A) CES top level function exponent

rhoac(C) domestic commodity aggregation function exponent

rhoq(C) Armington function exponent

rhot(C) CET function exponent

rhova(A) CES activity production function exponent

shif(INS,F) share of dom. inst i in income of factor f

shii(INS,INSP) share of inst i in post-tax post-sav income of inst ip

supernum(H) LES supernumerary income

theta(A,C) yield of commodity c per unit of activity a

tins01(INS) 0-1 par for potential flexing of dir tax rates

trnsfr(INS,AC) transfers fr inst. or factor ac to institution ins

*Tax rates

ta(A) rate of tax on producer gross output value

te(C) rate of tax on exports

tf(F) rate of direct tax on factors (soc sec tax)

tinsbar(INS) rate of (exog part of) direct tax on dom inst ins

tm(C) rate of import tariff

tq(C) rate of sales tax

tva(A) rate of value-added tax

VARIABLES

CPI consumer price index (PQ-based)

DPI index for domestic producer prices (PDS-based)

DMPS change in marginal propensity to save for selected inst

DTINS change in domestic institution tax share

EG total current government expenditure

EH(H) household consumption expenditure

EXR exchange rate

FSAV foreign savings

GADJ government demand scaling factor

GOVSHR govt consumption share of absorption

GSAV government savings

IADJ investment scaling factor (for fixed capital formation)

INVSHR investment share of absorption

MPS(INS) marginal propensity to save for dom non-gov inst ins

MPSADJ savings rate scaling factor

PA(A) output price of activity a

PDD(C) demand price for com c produced & sold domestically

PDS(C) supply price for com c produced & sold domestically

PE(C) price of exports

PINTA(A) price of intermediate aggregate

PM(C) price of imports

PQ(C) price of composite good c

PVA(A) value added price

PWE(C) world price of exports

PWM(C) world price of imports

PX(C) average output price

PXAC(A,C) price of commodity c from activity a

QA(A) level of domestic activity

QD(C) quantity of domestic sales

QE(C) quantity of exports

QF(F,A) quantity demanded of factor f from activity a

QFS(F) quantity of factor supply

QG(C) quantity of government consumption

QH(C,H) quantity consumed of marketed commodity c by household h

QHA(A,C,H) quantity consumed of home commodity c fr act a by hhd h

QINT(C,A) quantity of intermediate demand for c from activity a

QINTA(A) quantity of aggregate intermediate input

QINV(C) quantity of fixed investment demand

QM(C) quantity of imports

QQ(C) quantity of composite goods supply

QT(C) quantity of trade and transport demand for commodity c

QVA(A) quantity of aggregate value added

QX(C) quantity of aggregate marketed commodity output

QXAC(A,C) quantity of ouput of commodity c from activity a

TABS total absorption

TINS(INS) rate of direct tax on domestic institutions ins

TINSADJ direct tax scaling factor

TRII(INS,INSP) transfers to dom inst insdng from insdngp

WALRAS savings-investment imbalance (should be zero)

WF(F) economy-wide wage (rent) for factor f

WFDIST(F,A) factor wage distortion variable

YF(F) factor income

YG total current government income

YIF(INS,F) income of institution ins from factor f

YI(INS) income of (domestic non-governmental) institution ins

EQUATIONS

*Price block===============================================

PMDEF(C) domestic import price

PEDEF(C) domestic export price

PDDDEF(C) demand price for com c produced and sold domestically

PQDEF(C) value of sales in domestic market

PXDEF(C) value of marketed domestic output

PADEF(A) output price for activity a

PINTADEF(A) price of aggregate intermediate input

PVADEF(A) value-added price

CPIDEF consumer price index

DPIDEF domestic producer price index

*Production and trade block================================

CESAGGPRD(A) CES aggregate prod fn (if CES top nest)

CESAGGFOC(A) CES aggregate first-order condition (if CES top nest)

LEOAGGINT(A) Leontief aggreg intermed demand (if Leontief top nest)

LEOAGGVA(A) Leontief aggreg value-added demand (if Leontief top nest)

CESVAPRD(A) CES value-added production function

CESVAFOC(F,A) CES value-added first-order condition

INTDEM(C,A) intermediate demand for commodity c from activity a

COMPRDFN(A,C) production function for commodity c and activity a

OUTAGGFN(C) output aggregation function

OUTAGGFOC(A,C) first-order condition for output aggregation function

CET(C) CET function

CET2(C) domestic sales and exports for outputs without both

ESUPPLY(C) export supply

ARMINGTON(C) composite commodity aggregation function

COSTMIN(C) first-order condition for composite commodity cost min

ARMINGTON2(C) comp supply for com without both dom sales and imports

QTDEM(C) demand for transactions (trade and transport) services

*Institution block ========================================

YFDEF(F) factor incomes

YIFDEF(INS,F) factor incomes to domestic institutions

YIDEF(INS) total incomes of domest non-gov't institutions

EHDEF(H) household consumption expenditures

TRIIDEF(INS,INSP) transfers to inst ins from inst insp

HMDEM(C,H) LES cons demand by hhd h for marketed commodity c

HADEM(A,C,H) LES cons demand by hhd h for home commodity c fr act a

INVDEM(C) fixed investment demand

GOVDEM(C) government consumption demand

EGDEF total government expenditures

YGDEF total government income

*System constraint block===================================

COMEQUIL(C) composite commodity market equilibrium

FACEQUIL(F) factor market equilibrium

CURACCBAL current-account balance (of RoW)

GOVBAL government balance

TINSDEF(INS) direct tax rate for inst ins

MPSDEF(INS) marg prop to save for inst ins

SAVINVBAL savings-investment balance

TABSEQ total absorption

INVABEQ investment share in absorption

GDABEQ government consumption share in absorption

*Notational convention inside equations:

*Parameters and "invariably" fixed variables are in lower case.

*Potentially "variable" variables are in upper case.

*Price block===============================================

PMDEF(C)$CM(C)..

PM(C) =E= pwm(C)*(1 + tm(C))*EXR + SUM(CT, PQ(CT)*icm(CT,C));

PEDEF(C)$CE(C)..

PE(C) =E= pwe(C)*(1 - te(C))*EXR - SUM(CT, PQ(CT)*ice(CT,C));

PDDDEF(C)$CD(C).. PDD(C) =E= PDS(C) + SUM(CT, PQ(CT)*icd(CT,C));

PQDEF(C)$(CD(C) OR CM(C))..

PQ(C)*(1 - tq(c))*QQ(C) =E= PDD(C)*QD(C) + PM(C)*QM(C);

PXDEF(C)$CX(C).. PX(C)*QX(C) =E= PDS(C)*QD(C) + PE(C)*QE(C);

PADEF(A).. PA(A) =E= SUM(C, PXAC(A,C)*theta(A,C));

PINTADEF(A).. PINTA(A) =E= SUM(C, PQ(C)*ica(C,A)) ;

PVADEF(A).. PA(A)*(1-ta(A))*QA(A) =E= PVA(A)*QVA(A) + PINTA(A)*QINTA(A) ;

CPIDEF.. CPI =E= SUM(C, cwts(C)*PQ(C)) ;

DPIDEF.. DPI =E= SUM(CD, dwts(CD)*PDS(CD)) ;

*Production and trade block================================

*CESAGGPRD and CESAGGFOC apply to activities with CES function at

*top of technology nest.

CESAGGPRD(A)$ACES(A)..

QA(A) =E= alphaa(A)*(deltaa(A)*QVA(A)**(-rhoa(A))

+ (1-deltaa(A))*QINTA(A)**(-rhoa(A)))**(-1/rhoa(A)) ;

CESAGGFOC(A)$ACES(A)..

QVA(A) =E= QINTA(A)*((PINTA(A)/PVA(A))*(deltaa(A)/

(1 - deltaa(A))))**(1/(1+rhoa(A))) ;

*LEOAGGINT and LEOAGGVA apply to activities with Leontief function at

*top of technology nest.

LEOAGGINT(A)$ALEO(A).. QINTA(A) =E= inta(A)*QA(A) ;

LEOAGGVA(A)$ALEO(A).. QVA(A) =E= iva(A)*QA(A) ;

*CESVAPRD, CESVAFOC, INTDEM apply at the bottom of the technology nest

*(for all activities).

CESVAPRD(A)..

QVA(A) =E= alphava(A)*(SUM(F,

deltava(F,A)*QF(F,A)**(-rhova(A))) )**(-1/rhova(A)) ;

CESVAFOC(F,A)$deltava(F,A)..

WF(F)*wfdist(F,A) =E=

PVA(A)*(1-tva(A))

* QVA(A) * SUM(FP, deltava(FP,A)*QF(FP,A)**(-rhova(A)) )**(-1)

*deltava(F,A)*QF(F,A)**(-rhova(A)-1);

INTDEM(C,A)$ica(C,A).. QINT(C,A) =E= ica(C,A)*QINTA(A);

COMPRDFN(A,C)$theta(A,C)..

QXAC(A,C) + SUM(H, QHA(A,C,H)) =E= theta(A,C)*QA(A) ;

OUTAGGFN(C)$CX(C)..

QX(C) =E= alphaac(C)*SUM(A, deltaac(A,C)*QXAC(A,C)

**(-rhoac(C)))**(-1/rhoac(C));

OUTAGGFOC(A,C)$deltaac(A,C)..

PXAC(A,C) =E=

PX(C)

* QX(C) * SUM(AP, deltaac(AP,C)*QXAC(AP,C)**(-rhoac(C)) )**(-1)

*deltaac(A,C)*QXAC(A,C)**(-rhoac(C)-1);

CET(C)$(CE(C) AND CD(C))..

QX(C) =E= alphat(C)*(deltat(C)*QE(C)**rhot(C) +

(1 - deltat(C))*QD(C)**rhot(C))**(1/rhot(C)) ;

ESUPPLY(C)$(CE(C) AND CD(C))..

QE(C) =E= QD(C)*((PE(C)/PDS(C))*

((1 - deltat(C))/deltat(C)))**(1/(rhot(C)-1)) ;

CET2(C)$( (CD(C) AND CEN(C)) OR (CE(C) AND CDN(C)) )..

QX(C) =E= QD(C) + QE(C);

ARMINGTON(C)$(CM(C) AND CD(C))..

QQ(C) =E= alphaq(C)*(deltaq(C)*QM(C)**(-rhoq(C)) +

(1 -deltaq(C))*QD(C)**(-rhoq(C)))**(-1/rhoq(C)) ;

COSTMIN(C)$(CM(C) AND CD(C))..

QM(C) =E= QD(C)*((PDD(C)/PM(C))*(deltaq(C)/(1 - deltaq(C))))

**(1/(1 + rhoq(C)));

ARMINGTON2(C)$( (CD(C) AND CMN(C)) OR (CM(C) AND CDN(C)) )..

QQ(C) =E= QD(C) + QM(C);

QTDEM(C)$CT(C)..

QT(C) =E= SUM(CP, icm(C,CP)*QM(CP) + ice(C,CP)*QE(CP) + icd(C,CP)*QD(CP));

*Institution block ========================================

YFDEF(F).. YF(F) =E= SUM(A, WF(F)*wfdist(F,A)*QF(F,A));

YIFDEF(INSD,F)$shif(INSD,F)..

YIF(INSD,F) =E= shif(INSD,F)*((1-tf(f))*YF(F) - trnsfr('ROW',F)*EXR);

YIDEF(INSDNG)..

YI(INSDNG) =E=

SUM(F, YIF(INSDNG,F)) + SUM(INSDNGP, TRII(INSDNG,INSDNGP))

+ trnsfr(INSDNG,'GOV')*CPI + trnsfr(INSDNG,'ROW')*EXR;

TRIIDEF(INSDNG,INSDNGP)$(shii(INSDNG,INSDNGP))..

TRII(INSDNG,INSDNGP) =E= shii(INSDNG,INSDNGP)

* (1 - MPS(INSDNGP)) * (1 - TINS(INSDNGP))* YI(INSDNGP);

EHDEF(H)..

EH(H) =E= (1 - SUM(INSDNG, shii(INSDNG,H))) * (1 - MPS(H))

* (1 - TINS(H)) * YI(H);

HMDEM(C,H)$betam(C,H)..

PQ(C)*QH(C,H) =E=

PQ(C)*gammam(C,H)

+ betam(C,H)*( EH(H) - SUM(CP, PQ(CP)*gammam(CP,H))

- SUM((A,CP), PXAC(A,CP)*gammah(A,CP,H))) ;

HADEM(A,C,H)$betah(A,C,H)..

PXAC(A,C)*QHA(A,C,H) =E=

PXAC(A,C)*gammah(A,C,H)

+ betah(A,C,H)*(EH(H) - SUM(CP, PQ(CP)*gammam(CP,H))

- SUM((AP,CP), PXAC(AP,CP)*gammah(AP,CP,H))) ;

INVDEM(C).. QINV(C) =E= IADJ*qbarinv(C);

GOVDEM(C).. QG(C) =E= GADJ*qbarg(C);

YGDEF..

YG =E= SUM(INSDNG, TINS(INSDNG)*YI(INSDNG))

+ SUM(f, tf(F)*YF(F))

+ SUM(A, tva(A)*PVA(A)*QVA(A))

+ SUM(A, ta(A)*PA(A)*QA(A))

+ SUM(C, tm(C)*pwm(C)*QM(C))*EXR

+ SUM(C, te(C)*pwe(C)*QE(C))*EXR

+ SUM(C, tq(C)*PQ(C)*QQ(C))

+ SUM(F, YIF('GOV',F))

+ trnsfr('GOV','ROW')*EXR;

EGDEF.. EG =E= SUM(C, PQ(C)*QG(C)) + SUM(INSD, trnsfr(INSD,'GOV'))*CPI;

*System constraint block===================================

FACEQUIL(F).. SUM(A, QF(F,A)) =E= QFS(F);

COMEQUIL(C)..

QQ(C) =E= SUM(A, QINT(C,A)) + SUM(H, QH(C,H)) + QG(C)

+ QINV(C) + qdst(C) + QT(C);

CURACCBAL..

SUM(C, pwm(C)*QM(C)) + SUM(F, trnsfr('ROW',F)) =E=

SUM(C, pwe(C)*QE(C)) + SUM(INSD, trnsfr(INSD,'ROW')) + FSAV;

GOVBAL.. YG =E= EG + GSAV;

TINSDEF(INSDNG)..

TINS(INSDNG) =E= tinsbar(INSDNG)*(1 + TINSADJ*tins01(INSDNG)) + DTINS*tins01(INSDNG);

MPSDEF(INSDNG)..

MPS(INSDNG) =E= mpsbar(INSDNG)*(1 + MPSADJ*mps01(INSDNG)) + DMPS*mps01(INSDNG);

SAVINVBAL..

SUM(INSDNG, MPS(INSDNG) * (1 - TINS(INSDNG)) * YI(INSDNG))

+ GSAV + FSAV*EXR =E=

SUM(C, PQ(C)*QINV(C)) + SUM(C, PQ(C)*qdst(C)) + WALRAS;

TABSEQ..

TABS =E=

SUM((C,H), PQ(C)*QH(C,H)) + SUM((A,C,H), PXAC(A,C)*QHA(A,C,H))

+ SUM(C, PQ(C)*QG(C)) + SUM(C, PQ(C)*QINV(C)) + SUM(C, PQ(C)*qdst(C));

INVABEQ.. INVSHR*TABS =E= SUM(C, PQ(C)*QINV(C)) + SUM(C, PQ(C)*qdst(C));

GDABEQ.. GOVSHR*TABS =E= SUM(C, PQ(C)*QG(C));

使用道具

7
zhengzn 发表于 2007-3-19 15:35:00 |只看作者 |坛友微信交流群
gams网站上有大量的CGE模型可参埏,见www.gams.com/modlib/libhtml/seqindx.htm

使用道具

8
xuehe 发表于 2007-3-21 13:29:00 |只看作者 |坛友微信交流群

你所谓网上的是word,会是这些组合程序吗?!

使用道具

9
xuehe 发表于 2007-3-21 13:31:00 |只看作者 |坛友微信交流群
你在捣乱,里面有组件,说明等,你整明白啦?!

使用道具

10
zhaomn200145 发表于 2007-3-22 09:38:00 |只看作者 |坛友微信交流群
查过Gauss版的CGE模型的程序,跟6楼的有点象,不知道楼主的程序是什么样的,能简单介绍一下吗?谢谢

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-11 03:48