Recommended Methods to ReCalculate Regional and Total Economic Surpluses after Solving Spatial Equilibrium Models by the Non-Linear Programming Method

The current non-linear programming method does not derive regional economic surpluses and may derive an imprecise maximized value of the total economic surplus. The main reason is that the integrals for supply functions will automatically take regional non-economic producer surpluses into account if any intercepts of supply functions is negative. Consequently, the derived values are always lower than the real regional and total economic surpluses. The unknown regional economic surpluses and the imprecise total economic surplus will limit the suitable application of the model for broader contexts including game theory analysis, international trade policy analysis, and even GDP calculation. This paper recommends two formulae applied for two types of functions, namely original and inverse supply and demand functions, to calculate the regional and total economic surpluses of commodities. The two methods can be converted to each other conveniently, for example by using an inverse matrix of coefficients of original supply and demand functions to solve coefficients of inverse supply and demand functions. A numerical example is used to illustrate the spatial equilibrium model for 2 products and 3 regions with original linear supply and demand functions.


Introduction
The concept of the spatial equilibrium model was raised in the late 19 th century [1].The mathematics of the model have undergone step by step developed since 1950.The mathematical model was developed firstly by Enke in 1951 and independently by Samuelson in 1952.Samuelson was the first person who stated that the spatial equilibrium between various markets might be solved by mathematical programming, and formulated the problem as the maximization of the area under all excess demand curves, plus the area under all excess supply curves, minus the total transportation costs [2].Later, the spatial equilibrium model with the quadratic objective function was developed partially by Takayama and Judge in 1964 and fully by these authors in 1973 [1].
Until 2011, there were three common methods applied to derive optimal solutions for spatial equilibrium models.Non-linear programming is the most common method used to solve spatial equilibrium models with a non-linear objective function for the total economic surplus including linear and non-linear supply and demand functions as presented in journal articles and mathematical programming books including Takayama and Judge (1964) [3] and McCarl and Spreen (2002) [4].
Linear programming is used to solve spatial equilibrium models with linear supply functions, linear demand functions, and linear objective function of the total transportation cost as presented in Phan, Harrison, and Lamb (2011) [5].Mixed complementary programming is used to derive optimal solutions for spatial equilibrium models without any objective function, as presented in Goletti et al. (1996) [6], but requires some strict conditions and in particular equal numbers of constraints and equations [4].All three methods were published on the website of the General Algebraic Modeling System (GAMS) in November 2010 as presented in Phan (2010) [7].Various software packages can be used for the three programming methods, for example the Solver facility in Microsoft Excel (for relatively small models) and the General Algebraic Modeling System (GAMS) software which will solve models with tens of thousands of activities and constraints [1].
In terms of economic-reality aspects, the three methods can derive correctly optimal solutions of regional prices, regional supply quantities, regional demand quantities, regional transport quantities, and the total transportation cost.However, the optimal solution derived for the total economic surplus can be imprecise.In addition, the current methods do not calculate regional economic surpluses in aggregate or for each specific commodity.Therefore, the following sections examine why the two limitations exist and proposes how to solve precisely the economic surpluses of commodities, regional economic surpluses, and the total economic surplus generated by the spatial equilibrium models with linear supply and demand functions.

The Operation of a Simple Theoretical Spatial Equilibrium Model
The spatial equilibrium model is the broadest market equilibrium model [1].The spatial equilibrium model determines the equilibrium prices and quantities simultaneously, not only in all markets but also in all regions.Figure 1 describes how a simple spatial equilibrium model for one product and two regions moves to the optimal point.
When the commodity can be traded between two regions, the commodity is transported from a lower price region to a higher price region-from Region 1 to Region 2 in Figure 1.When producers in Region 1 transport their product to Region 2, the price in Region 1 increases and the price in Region 2 falls.The price difference between the two regions is reduced until it is less than or equal to the unit transportation cost [1].If applied to the same region for different products and zero unit transportation cost, the model becomes a general equili- brium model.And, if the unit transportation cost is higher than the price difference between regions, the two regions are separated and this simple model can be split into two partial equilibrium models [1].
For a general case-a spatial equilibrium model for multiple products and multiple regions-the theoretical explanation for the commodity movement is that "the quantity traded is the amount such that the total economic surplus of all products of all regions is maximized" or "the quantity traded is the amount such that the total transportation cost of all products between all regions is minimized".Mathematically, the maximization process leads to the optimal regional prices, regional supply quantities and regional demand quantities, and total economic surplus.The minimization process identifies the optimal quantities traded between regions and the total transportation cost.
In Figure 1, the black triangles for Regions 1 and 2 are the optimal consumer surpluses, the grey triangles for Regions 1 and 2 are the optimal producer surpluses, and the light grey square in Region 2 is the minimized total transportation cost.The sum of optimal consumer surpluses plus the sum of optimal producer surpluses is the maximized total economic surplus.At the optimal or equilibrium status, the export quantity of Region 1 equals the import quantity of Region 2. The import value of Region 2 equals to the export value of Region 1 plus the total transportation cost.The price difference between the two regions is smaller than or equal to the unit transportation cost.

Regional and Total Economic Surpluses of a Simple Theoretical Spatial Equilibrium Model with Inverse Linear Supply and Demand Functions
Mathematically, the behavior of producers is expressed as the supply quantity being a function of supply price,

( )
S f r = , called the original supply function.Similarly, the behavior of producers is expressed as the supply price being a function of supply quantity, ( ) , called the inverse supply function.Similarly, the behavior of buyers can be expressed in two alternative ways, ( ) The inverse functions ( ) ( ) are applied in most economics and mathematical programming textbooks and international journals, for instance in the economics book by Mansfield (1996) [19], and in the journal articles of Stennes and Wilson (2005) [13] and Devadoss, Angel, Steven and Jim (2005) [14].The main reason may be that the application of inverse supply and demand functions in economics textbooks can explain main ideas of economics in an easy-to-understand way, for example illustrating that the total area under the demand curve and above the market equilibrium price line forms the consumer economic surplus.
In almost economics textbooks, the total economic surplus is calculated as the sum of the areas of black and grey triangles presented in Figure 1 by the basic formula to calculate the area of a triangle, as base multiplied by height and then divided by 2. However, in almost programming books, in order to derive conveniently the total economic surplus for large-scale spatial equilibrium models with various types of functions, researchers nor-mally use the integrals of inverse supply and demand functions, representing the areas under the demand curves and areas under the supply curves to calculate the total economic surplus.At an aggregate level, the objective function of the total economic surplus is expressed as the sum of all regional economic surpluses of all commodities minus the total transportation cost or ( ) ( )

∑ ∫ ∫
. The most currently applied mathematical expression for the simple two-region model is presented below.Maximize the total economic surplus: ( ) Here: , i i′ : Region i and region i′  2).In Part (3), the total economic surplus will be the sum of all black and grey areas for the two regions.The export quantity of Region 1 equals to the import quantity of Region 2. The import value of Region 2 equals to the export value of Region 1 plus the total transportation cost.The price difference between the two regions is smaller than the unit transportation cost between the two regions.However, this application of integrals will face the two following difficulties.Unlike at aggregate level, at regional level the similar objective function expressed as ( d d p D r S − ∫ ∫ − the regional transportation cost) does not represent the economic surplus of a region.For example, in the export region (Region 1), the calculation of ( d d p D r S − ∫ ∫ − the regional transportation cost) represents the black train- gle area (consumer surplus) plus the grey area (only part of producer surplus) minus the light grey area (the export cost).This implies that if researchers would like to know the regional economic surplus of Region 1, they should plus the total export value but not minus the regional transportation cost, or they should apply the formu- In the import region (Region 2), the calculation of ( d d p D r S − ∫ ∫ − the regional transportation cost) also does not present the economic surplus of a region.This calculation represents the black triangle area (consumer surplus) plus the grey triangle area (producer surplus) plus the light grey square area.The light grey square means the import value includes the regional transportation cost.This implies that if researchers would like to know the regional economic surplus of Region 2, they should minus the total import value but not minus the regional transportation cost or apply the formula: ( ) According to the above formulae, the regional economic surplus of the export or import region does not take into account the regional transportation costs because the regional transportation cost is already included in the regional import values generated automatically by the application of integrals of inverse supply and demand functions.In addition, the current calculation of the total economic surplus by applying the integrals will not be precise if intercepts of any regional inverse supply functions are negative, as presented in Figure 3.
When the intercepts 1 of regional supply functions are negative, integrals of regional inverse supply functions will automatically include regional negative non-economic values2 in producer costs, and will reduce the producer surpluses, regional economic surpluses and total economic surplus.The reduced surplus is the area of the black triangle ( ) in Figure 3.This situation commonly happens 3 , so in order to solve the regional and total economic surpluses correctly, researchers should take into account the case having negative intercepts of inverse supply functions.The recommended formula to re-calculate regional and total economic surpluses for the simple model having negative intercepts of the supply functions is presented below. 1 There is a difference between constant and intercept.For example, in the inverse supply function: S is the supply quantity of commodity 1, 2 S is the supply quantity of commodity 2, 1 r is the supply price of commodity 1, 1 β is own-quantity supply coefficient for commodity 1, and 2 β is the cross-quantity supply coefficient of commodity 2 to commodity 1, 1 α is a constant, and ( ) Here: TE : The total economic surplus RE i : The economic surplus of region i , i i D S * * : Regional demand quantity, supply quantity at market equilibrium points , i i P r : Regional demand function of i D and regional supply function of i S , ex i i Q ′ : Quantity export from region i to region i′ at market equilibrium points , im i i Q ′ : Quantity import from region i′ to region i at market equilibrium points i α : The negative intercepts of inverse supply functions in region i i β : The positive own-quantity coefficient of inverse functions in region .i For greater clarity, the recommended formula to re-calculate the regional and total economic surpluses after solving the simple spatial equilibrium model having negative intercepts of the supply functions by the current non-linear programming method is illustrated by six steps in Figure 4.

Regional and Total Economic Surpluses of a Simple Theoretical Spatial Equilibrium Model with Original Linear Supply and Demand Functions
Although the coefficients between original and inverse functions can be converted rather conveniently 4 , fewer studies have used spatial equilibrium models with inverse supply and demand functions than that with original supply and demand functions, ( ) ( ) The main reason may be that econometric models with original functions are normally used to estimate price coefficients and price elasticities of supply and demand.
Phan and Harrison (2011) [1] found that the application of the objective function of ( ) generates similar optimal solutions of regional supply quantities, regional demand quantities, regional transport quantities, regional prices, and total transportation cost.However, the solutions differ in terms of how values of objective functions are interpreted.If the objective function of original functions ( ) is used, the optimal objective value is the total economic cost (producer cost plus consumer cost), not the total economic surplus as presented in Sections 1 and 2 5 .Similar to the application of integrals for inverse linear supply functions, the application for original linear supply functions also generates an imprecise regional producer surplus if intercepts of these functions are negative.In addition, the objective function of the total economic cost cannot be used to calculate directly the total economic surplus.Therefore, the five steps listed below set out how to calculate the precise regional and total economic surpluses for studies applying spatial equilibrium models with original linear supply and demand functions. 4Depending on the modelers' purposes for using variables, the coefficients of inverse supply and demand functions can be converted to those of original supply and demand functions and vice versa by using matrix inverse command in Excel.For example, if the followings are original linear demand functions, ( ) This matrix can be re-written as the second matrix:  .300 1 10 By using the inverse matrix command in Excel, the second matrix can be transformed to the third matrix: The third matrix can be transform to following two inverse demand equations:  Steps to re-calculate the regional and total economic surpluses for the simple spatial equilibrium model if intercepts of inverse linear supply functions are negative.Note: the calculation including plus (+) and minus (−) presented in this figure is applied for positive areas of grey shapes.
1.The current method, for example the non-linear programming method with the objective function of ( )

∑ ∫ ∫
, is used to derive the optimal solutions of regional supply quantities, regional demand quantities, regional transport quantities, regional prices, and total transportation cost.The mathematical expression for this simple model is presented below.Minimize the total economic cost: where: , i i′ : Region i and region i′ i P : Demand price in region i i r : Supply price in region i TEC: Total economic cost i D : Demand quantity in region i i S : Supply quantity in region i , i i Q ′ : Quantity transported (or exported) from region i to region i′ , i i U ′ : Unit transportation cost to transport one unit of commodity from region i to region i′ 2. The optimal solutions found in Step 1 are used to calculate the intercepts of the regional original linear de-mand and supply functions.The formulae to calculate the intercepts are presented below.For supply functions: For demand functions: where: i γ : The intercepts of original supply functions in region i i δ : The positive own-prices coefficient of original supply functions in region i i α : The intercepts of original demand functions in region i i β : The negative own-price coefficients of original demand functions in region i , i i D S * * : Regional demand quantity, supply quantity at equilibrium points , i i P r * * : Regional demand price and supply price at equilibrium points.
3. The calculated intercepts of regional original demand functions in Step 2 and the given demand own-price coefficients, i α and i β respectively, are used to calculate the whole area under it.The whole area is the total consumer surplus if product price is zero.The recommended formula to calculate the whole areas is: where: AR i : The total value of the whole area under the demand curve of the region i , i i D P : The demand quantity and demand price, and i D is a function of i P with found intercepts in Step 1 and given own-price coefficients.4. If the regional supply intercepts are positive, the regional and total economic surpluses can be calculated by the recommended formulae below: ( ) where: TE: The total economic surplus RE i : The economic surplus of region i AR i : The total value of the whole area under the demand curve of the region i , i i P r * * : Regional demand price and supply price at equilibrium points , i i D S : Regional demand function of i P and regional supply function of i r respectively.5.If the regional supply intercepts are negative, the above regional economic surpluses should be adjusted due to the negative non-economic values of producer surpluses generated automatically by the application of integrals of original linear supply and demand functions.The sum of found regional economic surpluses is the precise total economic surplus.The following are recommended formulae to re-calculate regional and total economic surpluses.
( ) where: i γ : The negative intercepts of original supply functions in region i i δ : The positive own-price coefficient of original supply functions in region i For greater clarity, Figure 5 describes steps to calculate precise regional and total economic surpluses for the simple spatial equilibrium model with original linear supply function having negative intercepts and demand functions after the optimal solutions of regional supply quantities, regional demand quantities, regional transport quantities, and regional prices are obtained by the current non-linear programming method.

A numerical Example for a Representative Spatial Equilibrium Model with Original Linear Supply and Demand Functions
A numerical example slightly modified from that of Takayama and Judge (1964) [3] is used to illustrate the method of calculating regional and total economic surpluses for the spatial equilibrium model with original linear supply and demand functions.The example having 2 products and 3 regions is fully representative of any spatial equilibrium models with n products and m regions.The hypothetical original linear supply and demand functions for two products in three regions are presented in Table 1 6 .The unit transportation costs (t i , rr' , the cost to transport one unit of product i from region r to region r′ ) are as in Table 2.For example, the unit transportation cost for product 1 from region 2 to region 1 is 2, and from region 2 to region 3 is 1.
Suppose that an economist would like to find answers for the following 9 questions: 1.What are the optimal regional prices (supply price, s ri P , equal to demand price, d ri P )?
2. What are optimal regional supply quantities ( ) ri S ?
3. What are optimal regional demand quantities ( ) ri D ?
4. What are optimal regional transport quantities ( ) , rr i Q ′ , and import and export values ( Im ri and Ex ri )? 5. What is the minimized total transportation cost (TC)?
6. What are the optimal regional transportation costs ( ) 7. What are the regional economic surpluses and the maximized total economic surplus without taking import and export values and signs of intercepts of supply functions into account (imprecise TE)? Steps to re-calculate the regional and total economic surpluses for the simple spatial equilibrium models if intercepts of regional original linear supply functions are negative.Note: the calculation including plus (+) and minus (−) presented in this figure is applied for positive areas of grey shapes.
Table 1.Original linear supply and demand functions for two products in three regions.Note: D is demand quantity, S is supply quantity, p d is demand price, p s is supply price, r is the subscript for region (r = 1, 2, 3) and i is the subscript for product (i = 1, 2). 8. What is the maximized total economic surplus when taking signs of intercepts of supply functions into account (precise TE)? 9. What are optimal regional economic surpluses (precise RE ri ), and regional producer surpluses (precise PS ri ) and regional consumer surpluses (precise CS ri )?A non-linear programming model written in a GAMS file with non-linear CONOPT Solver facilities is used to solve for regional prices, regional supply quantities, regional demand quantities, quantities traded between regions, and regional import and export values, as presented in Table 3 and Table 4, in answer to Questions 1 to 4 7 .
The optimal solutions in Table 3 indicate the regional prices of commodity 1 are 11, 9 and 10 in Regions 1, 2 and 3 respectively.Those of commodity 2 are 11.64, 8.64 and 10.64 in Regions 1, 2 and 3 respectively.
Table 3 indicates the regional supply quantities of commodity 1 are 65.5, 134.5, and 55 in Regions 1, 2 and 3 respectively.Those of commodity 2 are 120.36,160.23, and 104.86 in Regions 1, 2 and 3 respectively.Table 3. Optimal solutions of regional prices, regional supply quantities, and regional demand quantities-output of the computer program.Table 3 indicates that Region 2 is the only surplus region.The supply quantities of the commodity 1 (134.50)and the commodity 2 (160.23) are much higher than the demand quantities of the commodity 1 (64.00) and the commodity 2 (35.91).
Table 4 indicates that the export quantities of Region 2 for commodity 1 of 35.50 to Region 1 and of 35.00 to Region 3. Region 2's export quantities of commodity 2 are 74.91 to Region 1 and 49.41 to Region 3.
Table 4 indicates that the total import value of Region 1 is 1262.2, and that of Region 3 is 875.5.The total import value of the two regions is 2137.7,and the total export value of Region 2 is 1708.2.The difference between the total export and import values is the total transportation cost paid by consumers in import regions.Solutions by GAMS produces the regional and total transportation costs presented in Table 5, answering Questions 5 and 6.
Table 5 indicates that the regional transportation costs are paid by consumers of the import regions, namely Regions 1 and 3. Region 1 imports greater quantities than Region 3, and with given unit transportation costs, Region 1 pays more transportation cost (295.7)than Region 3 (133.8).The total transportation cost is 429.5.Region 2, the export region, does not pay for transportation costs.The regional transportation costs in Table 5 plus regional export values in Table 4 equal to the regional import values in Table 4.
If an economist does not take into account signs of the intercepts of original linear supply functions, and values of regional imports and exports, the imprecise total economic surplus generated by the GAMS programming is 6224.6.The number of 6224.6 is commonly solved by the non-linear programming method.The imprecise regional economic surpluses for the two cases are presented in Table 6 to answer for Question 7.
Table 6 indicates that if applying the objective function at aggregate level to regional level (or import and export values are not taken into account), regional economic surpluses can be negative as for the commodity 2 of Region 2 (−591.5) 8.
If an economist takes into account signs of the intercepts of original linear supply functions, the intercepts of the supply functions at equilibrium points found in Questions 1 to 4 will be obtained.GAMS programming produces regional intercepts of the original linear supply functions and intercepts as in Table 7.
Table 7 indicates that all intercepts of original linear supply functions are negative.This reveals that the application of integrals of original supply and demand functions automatically increased regional producer costs or reduced regional and total economic surpluses by the values presented in Table 8.If the economist takes into account the losses presented in Table 8, the precise total economic surplus in answer to Question 8 is 6736.12.The precise regional economic surpluses including producer and consumer surpluses are presented in Table 9 to answer for Question 9.
The values in Table 9 are equal to those in Table 6 plus those in Table 8.In addition to the reliable coefficients of supply and demand, the precise optimal solutions in Tables 1-5 and Table 9 can be used for various economics purposes, including regional and commodity policy analysis, international trade policy analysis, game theory analysis, regional external factor analysis for each commodity, and even to calculate regional GDP and regional GNP.

Concluding Comments
The optimal solution of the total economic surplus obtained by the current non-linear programming method can be imprecise.If the intercepts of supply functions are positive, the optimal solution is correct.If the intercepts of Table 9.The precise regional and total economic surpluses including producer and consumer surpluses with taking into account negative intercepts of original linear supply functions, as generated by GAMS.supply functions are negative, the estimated optimal solutions will be smaller than the correct ones because the application of integrals of supply functions automatically takes negative non-economic values into account.The three current methods do not calculate regional economic surpluses.If applying the similar objective functions of the current non-linear programming methods at the aggregate level for regional levels, regional economic surpluses cannot be correct.
For the spatial equilibrium model with inverse linear supply and demand functions, to calculate the regional economic surpluses, the financial values of regional imports and exports and signs of regional intercepts of the supply functions should be taken into account.The sum of regional economic surpluses is then the precise total economic surplus.For the spatial equilibrium model with original linear supply and demand functions, to calculate the regional economic surpluses, the values of the whole regional areas under the demand curves, signs of regional intercepts of the supply functions should be taken into account.The sum of regional economic surpluses will then be the precise total economic surplus.
These two proposed methods to calculate the precise regional and total economic surpluses can substitute for each other flexibly because the coefficients of inverse supply and demand functions can be converted to those of original supply and demand functions and vice versa simply by using the matrix inverse command in Excel.These two methods to calculate the regional and total economic surpluses can be expanded to other types of functions, for example logarithm functions, and to add time variable, for example a year variable to form a space-time equilibrium model.The more precise calculation of regional economic surpluses and total economic surplus will facilitate the application of spatial equilibrium models to more complicated contexts, for example how changes of a country's policies or exogenous factors will affect other countries' economic surpluses, and the total economic surplus.This analysis can support for some basic ideas of GAME theory, for example how a person's choice will impact on benefits to others and total benefits, and international trade theory, for example the more producer surplus of a commodity of a country has, the higher comparative advantage the commodity is.Equally, the more precise calculation can assist to estimate value added (VA), Gross Domestic Product (GDP), and Gross National Product (GNP).

Figure 1 .
Figure 1.Regional consumer and producer surpluses of a simple theoretical spatial equilibrium model for 1 product and 2 regions.

iP:In Figure 2 ,
Demand price in region i i r : Supply price in region i TE: The total economic surplus i D : Demand quantity in region i i S : Supply quantity in region i , i iQ ′ : Quantity transported from region i (export region) to region i′ (import region) , i i U ′ : Unit transportation cost to transport one unit of commodity from region i to region .i′ this expression means: the total economic surplus of the two regions = the black areas in Regions 1 and 2 + grey areas in Regions 1 and 2 − the light grey area in Region 1 + the light grey area in Region 2 − the light grey square in Region 2 (the total transportation cost area).The outcome of the expression presented in Figure2is correct or consistent with the theoretical explanation presented in Figure1in Section 1.In Figure 2, Part (3) is the result of Part (1) minus Part (

Figure 2 .
Figure 2. Regional economic surpluses expressed by the application of integrals of inverse linear supply and demand functions with positive intercepts of inverse supply functions.la: ( ) d d p D r S − ∫ ∫

Figure 3 .
Figure 3.The negative non-economic value is included automatically in the producer cost when the integral calculations are applied for negative intercepts of inverse supply functions ( ) i 0 α < .

5
Some journal articles and research reports have erroneously interpreted that the objective function ( )

Figure 4 .
Figure 4.Steps to re-calculate the regional and total economic surpluses for the simple spatial equilibrium model if intercepts of inverse linear supply functions are negative.Note: the calculation including plus (+) and minus (−) presented in this figure is applied for positive areas of grey shapes.

Figure 5 .
Figure 5.Steps to re-calculate the regional and total economic surpluses for the simple spatial equilibrium models if intercepts of regional original linear supply functions are negative.Note: the calculation including plus (+) and minus (−) presented in this figure is applied for positive areas of grey shapes.

Table 2 .
Unit transportation cost between regions.

Table 4 .
Optimal solutions of quantities transported between regions, regional import and export values, as generated by GAMS.

Table 5 .
Regional and total transportation costs, as generated by GAMS.

Table 6 .
The imprecise regional and total economic surpluses without considering signs of intercepts of original linear supply functions, as generated by GAMS.

Table 7 .
Intercepts of original linear supply functions at equilibrium points, as generated by GAMS.

Table 8 .
The regional and total economic surpluses lost due to the negative intercepts of original linear supply functions, as generated by GAMS.