```\$title	An illustrative MPSGE model -- water allocation and water trade

\$ontext

Here is a SAM in which we have three types of households: brewers,
farmers and workers.  The labor market is flexible -- workers can
move freely between the farm and the brewery.

In the benchmark equilibrium water is allocated to the farm and
brewery in exogenously-specified amounts: the farmer receives two
thirds and the brewer one third.  They are each charged the same
price for the water they receive.

GOVT collects the water payments and uses these funds to buy goods.

Suppose we want to model the consequences of permitting trade in
water rights between the farmer and the brewer.

f	b	farmer	brewer	worker	govt
pf	100		-30	-15	-45	-10
pb		100	-30	-20	-45	-5
pl	-30	-60			90
pw			-10	-5		15
pwf	-20		20
pwb		-20		20
pkf	-50		50
pkb		-20		20

\$offtext

scalar	wrt	Scalar flag for water rights trade /0/;

\$ontext

\$model:water

\$sectors:
f	!	Farm
b	!	Brewery
wt\$wrt	!	Water transfers

\$commodities:
pf	!	Price of farm output
pb	!	Price of beer
pwf	!	Shadow price of water on the farm
pwb	!	Shadow price of water in the brewery
pkf	!	Capital return -- farm
pkb	!	Capital return -- brewery
pl	!	Wage rate

\$consumers:
farmer
brewer
worker
govt	!	Government

*	Water rights trade moves one physical unit of
*	water from the farmer to the brewer.  The coefficients
*	here represent differences in the marginal product of
*	water in the base period -- the farmer receives twice
*	as much water as the brewer, yet the shadow value of
*	water in the two sectors is identical.  This implies
*	that the physical units are two to one:
*
\$prod:wt\$wrt
o:pwb	q:2
i:pwf	q:1

\$prod:f  s:0.5  kl:1
o:pf	q:100
i:pwf	q:20
i:pl	q:30	kl:
i:pkf	q:50	kl:

\$prod:b  s:0.25  kl:1
o:pb	q:100
i:pwb	q:20
i:pkb	q:20    kl:
i:pl	q:60    kl:

\$demand:farmer	s:1
d:pb	q:30
d:pf	q:30
e:pwf	q:20
e:pkf	q:50

*	The following entries denominate payments to
*	government for water rights.  The choice of 5/5
*	is entirely arbitrary.

*	On denominating transfers: It is as though a teenager tells
*	her father that if he lets her drive the car for a week
*	she will work around the house for two weeks next summer.
*	The amount that he receives in return for use of the
*	car depends on the marginal product of that time which may
*	be more or less than it is at the time of the contract.

e:pb	q:-5
e:pf	q:-5

\$demand:brewer s:1
d:pf	q:15
d:pb	q:20
e:pwb	q:20
e:pkb	q:20

*	For simplicity, suppose that payment for water rights
*	is denominated in terms of pl (the wage rate):

e:pl	q:(-5)

*	Note -- in this experiment, water trade increases the
*	real wage, so the choice of labor as numeraire tends to
*	have a somewhat adverse impact on brewer welfare.
*	If the transfer were instead denominated in goods
*	(2.5 units of beer and 2.5 of farm), the welfare impact
*	is 1% less.  Given an overall welfare impact of nearly
*	20%, the numeraire choice is not so important.

\$demand:worker  s:1
d:pf	q:45
d:pb	q:45
e:pl	q:90

\$report:
v:w_farmer	w:farmer
v:w_brewer	w:brewer
v:w_worker	w:worker

\$demand:govt
d:pf	q:10
d:pb	q:5

*	Endowments representing water rights payments:

e:pb	q:5
e:pf	q:5
e:pl	q:5
\$offtext
\$sysinclude mpsgeset water

water.iterlim = 0;
\$include water.gen
solve water using mcp;

*	Compute an equilibrium with water rights trade:

wrt = 1;
water.iterlim = 8000;
\$include water.gen
solve water using mcp;

\$ontext

Net impacts:

3.3% decline in farm output
4.7% decline in farm capital earnings
4.3% increase in brewery output
2.4% increase in brewer capital earnings

5.7% increase in farmer welfare
19.5% decrease in brewer welfare
4.7% increase in worker welfare

LOWER          LEVEL          UPPER         MARGINAL

---- VAR F                   .             0.9671        +INF             .
---- VAR B                   .             1.0428        +INF             .
---- VAR WT                  .             1.7658        +INF             .
---- VAR PF                  .             1.0004        +INF             .
---- VAR PB                  .             0.9123        +INF             .
---- VAR PWF                 .             1.1257        +INF             .
---- VAR PWB                 .             0.5629        +INF             .
---- VAR PKF                 .             0.9528        +INF             .
---- VAR PKB                 .             1.0236        +INF             .
---- VAR PL                  .             1.0000        +INF             .
---- VAR FARMER              .            60.5937        +INF             .
---- VAR BREWER              .            26.7290        +INF             .
---- VAR WORKER              .            90.0000        +INF             .
---- VAR GOVT                .            14.5637        +INF             .
---- VAR W_FARMER            .             1.0571        +INF             .
---- VAR W_BREWER            .             0.8047        +INF             .
---- VAR W_WORKER            .             1.0467        +INF             .

\$offtext

```