Title: | Computing General Equilibrium |
---|---|
Description: | Developing general equilibrium models, computing general equilibrium and simulating economic dynamics with structural dynamic models in LI (2019, ISBN: 9787521804225) "General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press". When developing complex general equilibrium models, GE package should be used in addition to this package. |
Authors: | LI Wu <[email protected]> |
Maintainer: | LI Wu <[email protected]> |
License: | GPL-2 | GPL-3 |
Version: | 0.3.3 |
Built: | 2024-10-31 21:10:08 UTC |
Source: | CRAN |
This function computes the Cobb-Douglas demand structure matrix.
CD_A(alpha, Beta, p)
CD_A(alpha, Beta, p)
alpha |
a nonnegative numeric m-vector or m-by-1 matrix. |
Beta |
a nonnegative numeric n-by-m matrix whose each column sum equals 1. |
p |
a nonnegative numeric n-vector or n-by-1 matrix. |
A demand coefficient n-by-m matrix is computed which indicates the demands of agents (firms or consumers) for obtaining unit product or utility with Cobb-Douglas production functions or utility functions under the price vector p.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
CD_A(1, c(0.5, 0.5), c(1, 2)) ##### alpha <- c(5, 3, 1) Beta <- matrix(c( 0.6, 0.4, 0.2, 0.1, 0.4, 0.7, 0.3, 0.2, 0.1 ), 3, 3, TRUE) p <- 1:3 CD_A(alpha, Beta, p)
CD_A(1, c(0.5, 0.5), c(1, 2)) ##### alpha <- c(5, 3, 1) Beta <- matrix(c( 0.6, 0.4, 0.2, 0.1, 0.4, 0.7, 0.3, 0.2, 0.1 ), 3, 3, TRUE) p <- 1:3 CD_A(alpha, Beta, p)
This function computes a Cobb-Douglas monetary demand structure matrix in a monetary economy.
CD_mA(alpha, Beta, p)
CD_mA(alpha, Beta, p)
alpha |
a nonnegative numeric m-vector or m-by-1 matrix. |
Beta |
nonnegative numeric n-by-m matrix whose each column sum equals 1. |
p |
a nonnegative numeric n-vector or n-by-1 matrix. |
Some elements of Beta corresponding to money equal -1.
A n-by-m matrix is computed which indicates the (monetary) demand structure of agents (firms or consumers) with Cobb-Douglas production functions or utility functions under the price vector p.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
alpha <- c(1, 1, 1) Beta <- matrix(c( 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -1, -1, -1 ), 3, 3, TRUE) p <- c(1, 2, 0.1) CD_mA(alpha, Beta, p)
alpha <- c(1, 1, 1) Beta <- matrix(c( 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -1, -1, -1 ), 3, 3, TRUE) p <- c(1, 2, 0.1) CD_mA(alpha, Beta, p)
This function computes the CES demand coefficient matrix.
CES_A(sigma, alpha, Beta, p, Theta = NULL)
CES_A(sigma, alpha, Beta, p, Theta = NULL)
sigma |
a numeric m-vector or m-by-1 matrix. |
alpha |
a nonnegative numeric m-vector or m-by-1 matrix. |
Beta |
a nonnegative numeric n-by-m matrix. |
p |
a nonnegative numeric n-vector or n-by-1 matrix. |
Theta |
null or a positive numeric n-by-m matrix. |
A demand coefficient n-by-m matrix is computed which indicates the demands of agents (firms or consumers) for obtaining unit product or utility with CES production functions or utility functions (e.g. alpha*(beta1*x1^sigma+beta2*x2^sigma)^(1/sigma) or alpha*(beta1*(x1/theta1)^sigma+beta2*(x2/theta2)^sigma)^(1/sigma)) under the price vector p.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
CES_A(-1, 2, c(0.2, 0.1), c(1, 2)) ##### sigma <- c(-1, -1, -1) alpha <- c(1, 1, 1) Beta <- matrix(c( 0, 1, 1, 1, 0, 0, 1, 0, 0 ), 3, 3, TRUE) p <- 1:3 CES_A(sigma, alpha, Beta, p) ##### sigma <- -1e-10 alpha <- 1 Beta <- c(0.8, 0.2) Theta <- c(2, 1) p <- c(1, 1) CES_A(sigma, alpha, Beta, p, Theta) CD_A(alpha * prod(Theta^(-Beta)), Beta, p) CES_A(sigma, alpha, Beta, p, Beta) CD_A(alpha * prod(Beta^(-Beta)), Beta, p) CES_A(-1e5, alpha, Beta, p, Theta)
CES_A(-1, 2, c(0.2, 0.1), c(1, 2)) ##### sigma <- c(-1, -1, -1) alpha <- c(1, 1, 1) Beta <- matrix(c( 0, 1, 1, 1, 0, 0, 1, 0, 0 ), 3, 3, TRUE) p <- 1:3 CES_A(sigma, alpha, Beta, p) ##### sigma <- -1e-10 alpha <- 1 Beta <- c(0.8, 0.2) Theta <- c(2, 1) p <- c(1, 1) CES_A(sigma, alpha, Beta, p, Theta) CD_A(alpha * prod(Theta^(-Beta)), Beta, p) CES_A(sigma, alpha, Beta, p, Beta) CD_A(alpha * prod(Beta^(-Beta)), Beta, p) CES_A(-1e5, alpha, Beta, p, Theta)
This function computes a CES monetary demand coefficient matrix in a monetary economy.
CES_mA(sigma, alpha, Beta, p, Theta = NULL)
CES_mA(sigma, alpha, Beta, p, Theta = NULL)
sigma |
a numeric m-vector or m-by-1 matrix. |
alpha |
a nonnegative numeric m-vector or m-by-1 matrix. |
Beta |
a nonnegative numeric n-by-m matrix whose each column sum equals 1. |
p |
a nonnegative numeric n-vector or n-by-1 matrix. |
Theta |
null or a positive numeric n-by-m matrix. |
Some elements of Beta corresponding to money equal -1.
A n-by-m matrix is computed which indicates the (monetary) demand structure of agents (firms or consumers) with CES production functions or utility functions under the price vector p.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
alpha <- matrix(1, 6, 1) Beta <- matrix(c( 0, 1, 1, 0, 1, 1, 0.5, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0.5, 0, 0, 0.5, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, -1, -1, -1 ), 6, 6, TRUE) p <- c(1, 2, 0.1, 4, 5, 0.1) CES_mA(rep(-1, 6), alpha, Beta, p)
alpha <- matrix(1, 6, 1) Beta <- matrix(c( 0, 1, 1, 0, 1, 1, 0.5, 0, 0, 0, 0, 0, -1, -1, -1, 0, 0, 0, 0.5, 0, 0, 0.5, 0, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 0, -1, -1, -1 ), 6, 6, TRUE) p <- c(1, 2, 0.1, 4, 5, 0.1) CES_mA(rep(-1, 6), alpha, Beta, p)
This data set gives parameters of a CGE model of China based on the input-output table of 2012.
ChinaCGE2012
ChinaCGE2012
A list containing the following components:
A(state) | function | a function which returns a demand structure 41-by-38 matrix under a given price 41-vector. |
B | numeric | a supply structure 41-by-38 matrix. |
S0Exg | numeric | an exogenous supply 41-by-38 matrix. |
z0 | numeric | an initial exchange levels (i.e. activity levels, production levels or utility levels) 38-vector. |
subject.names | character | names of 41 subjects (or commodities). |
sector.names | character | names of 38 sectors. |
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ChinaCGE2012$A(list(p = rep(1, 41))) ##### cge <- function(GRExg = 0) { sdm( A = ChinaCGE2012$A, B = ChinaCGE2012$B, S0Exg = ChinaCGE2012$S0Exg, GRExg = GRExg, z0 = ChinaCGE2012$z0, priceAdjustmentVelocity = 0.03 ) } ##### ge0 <- cge() names(ge0$p) <- ChinaCGE2012$subject.names ge0$p names(ge0$z) <- ChinaCGE2012$sector.names ge0$z ##### ge6 <- cge(GRExg = 0.06) names(ge6$p) <- ChinaCGE2012$subject.names ge6$p names(ge6$z) <- ChinaCGE2012$sector.names ge6$z
ChinaCGE2012$A(list(p = rep(1, 41))) ##### cge <- function(GRExg = 0) { sdm( A = ChinaCGE2012$A, B = ChinaCGE2012$B, S0Exg = ChinaCGE2012$S0Exg, GRExg = GRExg, z0 = ChinaCGE2012$z0, priceAdjustmentVelocity = 0.03 ) } ##### ge0 <- cge() names(ge0$p) <- ChinaCGE2012$subject.names ge0$p names(ge0$z) <- ChinaCGE2012$sector.names ge0$z ##### ge6 <- cge(GRExg = 0.06) names(ge6$p) <- ChinaCGE2012$subject.names ge6$p names(ge6$z) <- ChinaCGE2012$sector.names ge6$z
This function works in the way analogous to the diag function of Matlab.
dg(x)
dg(x)
x |
a number, vector or square matrix. |
If x is a number, dg returns itself. If x is a vector, a one-row matrix or a one-column matrix, dg returns a matrix with x as the main diagnol. Otherwise dg returns diag(x).
LI Wu <[email protected]>
diag(matrix(2, 3)) dg(matrix(2, 3))
diag(matrix(2, 3)) dg(matrix(2, 3))
This is Example 15.B.1 in MWG (1995, P519), which is a pure exchange Cobb-Douglas 2-by-2 economy.
Example.MWG.15.B.1( a = 0.1, S0Exg = matrix(c( 1, 2, 2, 1 ), 2, 2, TRUE) )
Example.MWG.15.B.1( a = 0.1, S0Exg = matrix(c( 1, 2, 2, 1 ), 2, 2, TRUE) )
a |
Each consumer has the Cobb-Douglas utility function x1^a*x2^(1-a). |
S0Exg |
exogenous supply matrix which will be passed to the function sdm. |
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Mas-Colell, Andreu and Whinston, Michael Dennis and Green, Jerry R. (1995, ISBN: 0195073401) Microeconomic Theory. Oxford University Press (New York).
Example.MWG.15.B.1() ##### Example.MWG.15.B.1(a = 0.2) ##### S <- matrix(c( 18, 72, 40, 20 ), 2, 2, TRUE) ge <- Example.MWG.15.B.1(a = 0.2, S0Exg = S) ge$p / ge$p[1]
Example.MWG.15.B.1() ##### Example.MWG.15.B.1(a = 0.2) ##### S <- matrix(c( 18, 72, 40, 20 ), 2, 2, TRUE) ge <- Example.MWG.15.B.1(a = 0.2, S0Exg = S) ge$p / ge$p[1]
This is Example 15.B.2 in MWG (1995, P521), which is a pure exchange 2-by-2 economy with quasilinear utility functions.
Example.MWG.15.B.2(p0 = c(1, 0.3))
Example.MWG.15.B.2(p0 = c(1, 0.3))
p0 |
an initial price 2-vector, which will be passed to the function sdm. |
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Mas-Colell, Andreu and Whinston, Michael Dennis and Green, Jerry R. (1995, ISBN: 0195073401) Microeconomic Theory. Oxford University Press (New York).
ge <- Example.MWG.15.B.2() ge$p ##### ge <- Example.MWG.15.B.2(p0 = c(0.3, 1)) ge$p ##### ge <- Example.MWG.15.B.2(p0 = c(1, 1)) ge$p
ge <- Example.MWG.15.B.2() ge$p ##### ge <- Example.MWG.15.B.2(p0 = c(0.3, 1)) ge$p ##### ge <- Example.MWG.15.B.2(p0 = c(1, 1)) ge$p
This is Exercise 15.B.6 in MWG (1995, P541), which is a pure exchange CES 2-by-2 economy.
Example.MWG.Exercise.15.B.6(p0 = c(1, 2))
Example.MWG.Exercise.15.B.6(p0 = c(1, 2))
p0 |
an initial price 2-vector, which will be passed to the function sdm. |
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Mas-Colell, Andreu and Whinston, Michael Dennis and Green, Jerry R. (1995, ISBN: 0195073401) Microeconomic Theory. Oxford University Press (New York).
ge <- Example.MWG.Exercise.15.B.6() ge$p / ge$p[2] # (3/4)^3 ##### ge <- Example.MWG.Exercise.15.B.6(p0 = c(2, 1)) ge$p / ge$p[2] # (4/3)^3 ##### ge <- Example.MWG.Exercise.15.B.6(p0 = c(1, 1)) ge$p
ge <- Example.MWG.Exercise.15.B.6() ge$p / ge$p[2] # (3/4)^3 ##### ge <- Example.MWG.Exercise.15.B.6(p0 = c(2, 1)) ge$p / ge$p[2] # (4/3)^3 ##### ge <- Example.MWG.Exercise.15.B.6(p0 = c(1, 1)) ge$p
This is Exercise 15.B.9 in MWG (1995, P541), which is a pure exchange 2-by-2 economy.
Example.MWG.Exercise.15.B.9( S0Exg = matrix(c( 30, 0, 0, 20 ), 2, 2, TRUE) )
Example.MWG.Exercise.15.B.9( S0Exg = matrix(c( 30, 0, 0, 20 ), 2, 2, TRUE) )
S0Exg |
an exogenous supply matrix, which will be passed to the function sdm. |
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Mas-Colell, Andreu and Whinston, Michael Dennis and Green, Jerry R. (1995, ISBN: 0195073401) Microeconomic Theory. Oxford University Press (New York).
Example.MWG.Exercise.15.B.9() ##### S <- matrix(c( 5, 0, 0, 20 ), 2, 2, TRUE) Example.MWG.Exercise.15.B.9(S0Exg = S)
Example.MWG.Exercise.15.B.9() ##### S <- matrix(c( 5, 0, 0, 20 ), 2, 2, TRUE) Example.MWG.Exercise.15.B.9(S0Exg = S)
This is the example in Section.3.1.2 of Li (2019), which is a Leontief-type two-sector corn economy.
Example.Section.3.1.2.corn()
Example.Section.3.1.2.corn()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Exercise 18.2 in Varian (1992, P357), which is a Cobb-Douglas 3-by-4 economy.
Example.Varian.Exercise.18.2()
Example.Varian.Exercise.18.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Varian, Hal R. (1992, ISBN: 0393957357) Microeconomic Analysis. W. W. Norton & Company.
ge <- Example.Varian.Exercise.18.2() ge$A %*% diag(ge$z) #input matrix
ge <- Example.Varian.Exercise.18.2() ge$A %*% diag(ge$z) #input matrix
This is the example on page 352 in Varian (1992) (see also Example 15.C.2. in MWG, 1995, P542), which is a decreasing-returns-to-scale Cobb-Douglas 3-by-2 economy and can be transformed into a constant-returns-to-scale 3-by-3 (or 3-by-2) economy.
Example.Varian.P352(agent.number = 3)
Example.Varian.P352(agent.number = 3)
agent.number |
agent.number can be set to 3 or 2. |
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Mas-Colell, Andreu and Whinston, Michael Dennis and Green, Jerry R. (1995, ISBN: 0195073401) Microeconomic Theory. Oxford University Press (New York).
Varian, Hal R. (1992, ISBN: 0393957357) Microeconomic Analysis. W. W. Norton & Company.
Example.Varian.P352() ##### Example.Varian.P352(agent.number = 2)
Example.Varian.P352() ##### Example.Varian.P352(agent.number = 2)
This is Example 2.2 in Li (2019), which is a Cobb-Douglas pure production economy.
Example2.2()
Example2.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 2.3 in Li (2019), which is a von Neumann economy.
Example2.3()
Example2.3()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 3.1 in Li (2019),which is a two-sector corn economy with a non-homothetic utility function.
Example3.1()
Example3.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 3.10 in Li (2019),which is a Leontief corn economy with three primary factors.
Example3.10()
Example3.10()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 3.12 in Li (2019),which is an economy with decreasing returns to scale.
Example3.12()
Example3.12()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 3.14 in Li (2019),which illustrates the relationship between a regular economy and a pure exchange economy.
Example3.14()
Example3.14()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 3.2 in Li (2019),which is a Cobb-Douglas two-sector corn economy.
Example3.2()
Example3.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 3.2 in Li (2019),which is a Lontief three-sector economy with one primary factor.
Example3.4()
Example3.4()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 3.8 in Li (2019),which is a Cobb-Douglas three-sector economy with one primary factor.
Example3.8()
Example3.8()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 3.9 in Li (2019),which is a Cobb-Douglas three-sector economy with two primary factors.
Example3.9()
Example3.9()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 4.10 in Li (2019),which illustrates the tax.
Example4.10()
Example4.10()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the first part of Example 4.11 in Li (2019),which illustrates the tax.
Example4.11.1()
Example4.11.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the second part of Example 4.11 in Li (2019),which illustrates the tax.
Example4.11.2()
Example4.11.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 4.12 in Li (2019),which illustrates the tax.
Example4.12()
Example4.12()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 4.13 in Li (2019),which illustrates the divident.
Example4.13()
Example4.13()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 4.15 in Li (2019),which illustrates over-investment.
Example4.15()
Example4.15()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 4.16 in Li (2019),which illustrates technology monopoly.
Example4.16()
Example4.16()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 4.2 in Li (2019), which illustrates the non-sufficient supply of the primary factor.
Example4.2()
Example4.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 4.8 in Li (2019),which illustrates the increasing returns to scale.
Example4.8()
Example4.8()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 4.9 in Li (2019),which illustrates the price signal.
Example4.9()
Example4.9()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 5.1 in Li (2019),which illustrates fixed assets.
Example5.1()
Example5.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 5.10 in Li (2019),which illustrates pollution.
Example5.10()
Example5.10()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the first part of Example 5.11 in Li (2019),which illustrates pollution.
Example5.11.1()
Example5.11.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the second part of Example 5.11 in Li (2019),which illustrates pollution.
Example5.11.2()
Example5.11.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 5.2 in Li (2019),which illustrates fixed assets.
Example5.2()
Example5.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the first part of Example 5.3 in Li (2019),which illustrates fixed assets.
Example5.3.1()
Example5.3.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the second part of Example 5.3 in Li (2019),which illustrates fixed assets.
Example5.3.2()
Example5.3.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 5.4 in Li (2019),which illustrates fixed assets.
Example5.4()
Example5.4()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 5.5 in Li (2019),which illustrates fixed assets.
Example5.5()
Example5.5()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 5.6 in Li (2019),which illustrates fixed assets.
Example5.6()
Example5.6()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 6.10 in Li (2019),which illustrates a two-country economy.
Example6.10()
Example6.10()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 6.11 in Li (2019),which illustrates a two-country economy.
Example6.11()
Example6.11()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 6.13 in Li (2019),which illustrates a two-country economy.
Example6.13()
Example6.13()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ge <- Example6.13() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l")
ge <- Example6.13() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l")
This is the first part of Example 6.2 in Li (2019),which illustrates a two-country economy.
Example6.2.1()
Example6.2.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the second part of Example 6.2 in Li (2019),which illustrates a two-country economy.
Example6.2.2()
Example6.2.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 6.3 in Li (2019),which illustrates a two-country economy.
Example6.3()
Example6.3()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 6.4 in Li (2019),which illustrates a two-country economy.
Example6.4()
Example6.4()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 6.5 in Li (2019),which illustrates a two-country economy.
Example6.5()
Example6.5()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the first part of Example 6.6 in Li (2019),which illustrates a two-country economy.
Example6.6.1()
Example6.6.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the second part of Example 6.6 in Li (2019),which illustrates the first country of a two-country economy.
Example6.6.2()
Example6.6.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the third part of Example 6.6 in Li (2019),which illustrates the second country of a two-country economy.
Example6.6.3()
Example6.6.3()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 6.7 in Li (2019),which illustrates a two-country economy.
Example6.7()
Example6.7()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 6.9 in Li (2019),which illustrates a two-country economy.
Example6.9()
Example6.9()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.1 in Li (2019),which illustrates a monetary pure exchange economy.
Example7.1()
Example7.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.10 in Li (2019), which illustrates fiat money and representative money.
Example7.10()
Example7.10()
LI Wu <[email protected]>
LI Wu (2019) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is an extra part of Example 7.10 in Li (2019), which illustrates fiat money and representative money.
Example7.10.2()
Example7.10.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.11 in Li (2019), which illustrates bond.
Example7.11()
Example7.11()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.12 in Li (2019), which illustrates the foreign exchange rate and international credit.
Example7.12()
Example7.12()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.13 in Li (2019), which illustrates indirect financing based on commercial banks.
Example7.13()
Example7.13()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.14 in Li (2019), which illustrates shadow prices.
Example7.14()
Example7.14()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.15 in Li (2019), which illustrates shadow prices and international trade.
Example7.15()
Example7.15()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.2 in Li (2019),which illustrates a monetary Cobb-Douglas zero-growth corn economy.
Example7.2()
Example7.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
## Another way to compute this equilibrium, i.e. treating money as tax receipt. r <- 0.25 ge <- sdm( A = function(state) { alpha <- rbind(1, 1, 1) Beta <- matrix(c( 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ), 2, 3, TRUE) tmp.A <- CD_A(alpha, Beta, state$p[1:2]) tmp <- apply(tmp.A, 2, function(x) sum(x * state$p[1:2])) rbind(tmp.A, r * tmp / state$p[3]) }, B = diag(3), S0Exg = { tmp <- matrix(NA, 3, 3) tmp[2, 2] <- 100 tmp[3, 3] <- 100 tmp } ) ge$p / ge$p[3] * r p <- ge$p p[3] <- p[3] / r p / p[3]
## Another way to compute this equilibrium, i.e. treating money as tax receipt. r <- 0.25 ge <- sdm( A = function(state) { alpha <- rbind(1, 1, 1) Beta <- matrix(c( 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ), 2, 3, TRUE) tmp.A <- CD_A(alpha, Beta, state$p[1:2]) tmp <- apply(tmp.A, 2, function(x) sum(x * state$p[1:2])) rbind(tmp.A, r * tmp / state$p[3]) }, B = diag(3), S0Exg = { tmp <- matrix(NA, 3, 3) tmp[2, 2] <- 100 tmp[3, 3] <- 100 tmp } ) ge$p / ge$p[3] * r p <- ge$p p[3] <- p[3] / r p / p[3]
This is Example 7.3 in Li (2019),which illustrates a monetary Leontief corn economy.
Example7.3()
Example7.3()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.4 in Li (2019),which illustrates a monetary Cobb-Douglas positive-growth corn economy.
Example7.4()
Example7.4()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the first part of Example 7.5 in Li (2019),which illustrates a monetary Cobb-Douglas corn economy including dividend.
Example7.5.1()
Example7.5.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is the second part of Example 7.5 in Li (2019), which illustrates a monetary Cobb-Douglas corn economy including dividend.
Example7.5.2()
Example7.5.2()
LI Wu <[email protected]>
LI Wu (2019) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.6 in Li (2019), which illustrates foreign exchange rates.
Example7.6()
Example7.6()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.7 in Li (2019), which illustrates foreign exchange rates.
Example7.7()
Example7.7()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.8 in Li (2019), which illustrates commodity money.
Example7.8()
Example7.8()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 7.9 in Li (2019), which illustrates commodity money and representative money.
Example7.9X()
Example7.9X()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 8.1 in Li (2019), which expounds the equilibrium coffee problem.
Example8.1()
Example8.1()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 8.2 in Li (2019), which expounds a Cobb-Douglas market-clearing exchange process.
Example8.2()
Example8.2()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
This is Example 8.7 in Li (2019), which discusses price changes in the coffee economy.
Example8.7()
Example8.7()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ge <- Example8.7() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l")
ge <- Example8.7() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l")
This is Example 8.8 in Li (2019), which illustrates a dynamic exchange model with one type of money.
Example8.8()
Example8.8()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ge <- Example8.8() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l")
ge <- Example8.8() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l")
This is Example 8.9 in Li (2019), which illustrates a dynamic exchange model with multiple types of money.
Example8.9()
Example8.9()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ge <- Example8.9() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l")
ge <- Example8.9() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l")
This is Example 9.10-14 in Li (2019), which illustrates economic cycles in a monetary economy and economic policies ironing economic cycles.
Example9.10( policy = NULL, pExg = rbind(NA, NA, 0.25), p0 = rbind(0.625, 0.375, 0.25), priceAdjustmentVelocity = 0.3, ts = TRUE )
Example9.10( policy = NULL, pExg = rbind(NA, NA, 0.25), p0 = rbind(0.625, 0.375, 0.25), priceAdjustmentVelocity = 0.3, ts = TRUE )
Those arguments will be passed to the function sdm. See sdm
.
policy |
a policy function |
pExg |
an n-vector indicating the exogenous prices (if any). |
p0 |
an initial price n-vector. |
priceAdjustmentVelocity |
the price adjustment velocity. |
ts |
if TRUE, the time series of the last iteration are returned. |
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
sdm
;
Example9.10.policy.interest.rate
;
Example9.10.policy.money.supply
;
Example9.10.policy.deflation
;
Example9.10.policy.quantitative.easing
;
Example9.10.policy.tax
;
Example9.10.policy.deficit.fiscal
##### no policy ge <- Example9.10() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l") ##### interest rate policy (Fig. 9.12) Example9.10(policy = Example9.10.policy.interest.rate) ##### monetary supply policy (Fig. 9.13) Example9.10(policy = Example9.10.policy.money.supply) ##### deflation policy (Fig. 9.14) ge <- Example9.10( policy = Example9.10.policy.deflation, pExg = rbind(NA, NA, 0), p0 = rbind(0.625, 0.375, 0), ts = TRUE ) plot(ge$ts.S[3, 3, ], type = "l") plot(ge$ts.q[, 3], type = "l") ##### quantitative easing policy (Fig. 9.15) ge <- Example9.10( policy = Example9.10.policy.quantitative.easing, pExg = rbind(NA, NA, 0), p0 = rbind(0.625, 0.375, 0), ts = TRUE ) plot(log(ge$ts.S[3, 3, ]), type = "l") plot(ge$ts.q[, 3], type = "l") plot(log(ge$ts.p[, 1]), type = "l") lines(log(ge$ts.p[, 2]), col = "blue") ##### deficit fiscal policy (Fig. 9.17; Fig. 9.18) ge <- Example9.10( policy = Example9.10.policy.deficit.fiscal, priceAdjustmentVelocity = 0.5, ts = TRUE ) plot(ge$ts.S[3, 3, ], type = "l") plot(ge$ts.q[, 1], type = "l") deficit.Example9.10 <- ge$policy.data plot(deficit.Example9.10, type = "l") plot(deficit.Example9.10[, 1], cumsum(deficit.Example9.10[, 2]), type = "l") plot(deficit.Example9.10[, 1], cumsum(deficit.Example9.10[, 2]) / (tail(ge$ts.z[, 1] * ge$ts.p[, 1], -399)), type = "l" ) ##### tax policy (Fig. 9.16) ge <- Example9.10(policy = Example9.10.policy.tax) plot(ge$policy.data, type = "l")
##### no policy ge <- Example9.10() matplot(ge$ts.p, type = "l") matplot(ge$ts.z, type = "l") ##### interest rate policy (Fig. 9.12) Example9.10(policy = Example9.10.policy.interest.rate) ##### monetary supply policy (Fig. 9.13) Example9.10(policy = Example9.10.policy.money.supply) ##### deflation policy (Fig. 9.14) ge <- Example9.10( policy = Example9.10.policy.deflation, pExg = rbind(NA, NA, 0), p0 = rbind(0.625, 0.375, 0), ts = TRUE ) plot(ge$ts.S[3, 3, ], type = "l") plot(ge$ts.q[, 3], type = "l") ##### quantitative easing policy (Fig. 9.15) ge <- Example9.10( policy = Example9.10.policy.quantitative.easing, pExg = rbind(NA, NA, 0), p0 = rbind(0.625, 0.375, 0), ts = TRUE ) plot(log(ge$ts.S[3, 3, ]), type = "l") plot(ge$ts.q[, 3], type = "l") plot(log(ge$ts.p[, 1]), type = "l") lines(log(ge$ts.p[, 2]), col = "blue") ##### deficit fiscal policy (Fig. 9.17; Fig. 9.18) ge <- Example9.10( policy = Example9.10.policy.deficit.fiscal, priceAdjustmentVelocity = 0.5, ts = TRUE ) plot(ge$ts.S[3, 3, ], type = "l") plot(ge$ts.q[, 1], type = "l") deficit.Example9.10 <- ge$policy.data plot(deficit.Example9.10, type = "l") plot(deficit.Example9.10[, 1], cumsum(deficit.Example9.10[, 2]), type = "l") plot(deficit.Example9.10[, 1], cumsum(deficit.Example9.10[, 2]) / (tail(ge$ts.z[, 1] * ge$ts.p[, 1], -399)), type = "l" ) ##### tax policy (Fig. 9.16) ge <- Example9.10(policy = Example9.10.policy.tax) plot(ge$policy.data, type = "l")
This is the deficit fiscal policy for the economy of Example 9.10 in Li (2019), which is discussed in Example 9.14.
Example9.10.policy.deficit.fiscal(time, state, state.history)
Example9.10.policy.deficit.fiscal(time, state, state.history)
time |
the current time. |
state |
a list indicating the current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies. |
state.history |
the history of economic states. |
Example9.10.policy.deficit.fiscal returns a list indicating the modified current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels), supplies and current policy data.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Example9.10
;
Example9.10.policy.interest.rate
;
Example9.10.policy.money.supply
;
Example9.10.policy.deflation
;
Example9.10.policy.quantitative.easing
;
Example9.10.policy.tax
This is the deflation policy for the economy of Example 9.10 in Li (2019), which is discussed in Example 9.12.
Example9.10.policy.deflation(time, state, state.history)
Example9.10.policy.deflation(time, state, state.history)
time |
the current time. |
state |
a list indicating the current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies. |
state.history |
the history of economic states. |
Example9.10.policy.deflation returns a list indicating the modified current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Example9.10
;
Example9.10.policy.interest.rate
;
Example9.10.policy.money.supply
;
Example9.10.policy.quantitative.easing
;
Example9.10.policy.tax
;
Example9.10.policy.deficit.fiscal
This is the interest rate policy for the economy of Example 9.10 in Li (2019), which is discussed in Example 9.11.
Example9.10.policy.interest.rate(time, state, state.history)
Example9.10.policy.interest.rate(time, state, state.history)
time |
the current time. |
state |
a list indicating the current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies. |
state.history |
the history of economic states. |
Example9.10.policy.interest.rate returns a list indicating the modified current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Example9.10
;
Example9.10.policy.money.supply
;
Example9.10.policy.deflation
;
Example9.10.policy.quantitative.easing
;
Example9.10.policy.tax
;
Example9.10.policy.deficit.fiscal
This is the money supply policy for the economy of Example 9.10 in Li (2019), which is discussed in Example 9.12.
Example9.10.policy.money.supply(time, state, state.history)
Example9.10.policy.money.supply(time, state, state.history)
time |
the current time. |
state |
a list indicating the current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies. |
state.history |
the history of economic states. |
Example9.10.policy.money.supply returns a list indicating the modified current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Example9.10
;
Example9.10.policy.interest.rate
;
Example9.10.policy.deflation
;
Example9.10.policy.quantitative.easing
;
Example9.10.policy.tax
;
Example9.10.policy.deficit.fiscal
This is the deflation policy for the economy of Example 9.10 in Li (2019), which is discussed in Example 9.12.
Example9.10.policy.quantitative.easing(time, state, state.history)
Example9.10.policy.quantitative.easing(time, state, state.history)
time |
the current time. |
state |
a list indicating the current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies. |
state.history |
the history of economic states. |
Example9.10.policy.quantitative.easing returns a list indicating the modified current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Example9.10
;
Example9.10.policy.interest.rate
;
Example9.10.policy.money.supply
;
Example9.10.policy.deflation
;
Example9.10.policy.tax
;
Example9.10.policy.deficit.fiscal
This is the tax policy for the economy of Example 9.10 in Li (2019), which is discussed in Example 9.13.
Example9.10.policy.tax(time, state, state.history)
Example9.10.policy.tax(time, state, state.history)
time |
the current time. |
state |
a list indicating the current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels) and supplies. |
state.history |
the history of economic states. |
Example9.10.policy.tax returns a list indicating the modified current economic state including prices, exchange levels (i.e. activity levels, production levels or utility levels), supplies and current policy data.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
Example9.10
;
Example9.10.policy.interest.rate
;
Example9.10.policy.money.supply
;
Example9.10.policy.deflation
;
Example9.10.policy.quantitative.easing
;
Example9.10.policy.deficit.fiscal
This is Example 9.3 in Li (2019), which illustrates economic cycles in a pure production economy.
Example9.3()
Example9.3()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ge<-Example9.3() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
ge<-Example9.3() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
This is Example 9.4 in Li (2019), which illustrates economic cycles in a corn economy.
Example9.4()
Example9.4()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ge<-Example9.4() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
ge<-Example9.4() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
This is Example 9.5 in Li (2019), which illustrates the price-control equilibrium.
Example9.5()
Example9.5()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ge<-Example9.5() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
ge<-Example9.5() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
This is Example 9.6 in Li (2019), which illustrates the technological progress and capital accumulation in the corn economy.
Example9.6()
Example9.6()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ge<-Example9.6() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
ge<-Example9.6() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
This is Example 9.7 in Li (2019), which illustrates fixed assets and economic cycles.
Example9.7()
Example9.7()
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
ge<-Example9.7() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
ge<-Example9.7() matplot(ge$ts.p, type="l") matplot(ge$ts.z, type="l")
Given a price vector, a demand coefficient matrix and a supply matrix, this function computes the (disequilibrium) exchange results of an exchange process. There are n commodities and m agents in the exchange process.
F_Z(A, p, S)
F_Z(A, p, S)
A |
a n-by-m demand coefficient matrix. |
p |
a price n-vector. |
S |
a n-by-m supply matrix. |
F_Z returns a list containing the following components:
z |
an exchange amount m-vector. |
q |
a sales rate n-vector. |
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
A <- matrix(c( 0.05, 0.05, 0.1, 0.1, 0, 0.1, 0, 0.15, 0.05 ), 3, 3, TRUE) S <- diag(3) # a market-clearing price vector p <- c(0.6, 0.9, 1) result <- F_Z(A, p, S) # Each sales rate is equal to 1 result$q # the purchase matrix A %*% diag(result$z) # a non-market-clearing price vector p <- c(1, 1, 1) result <- F_Z(A, p, S) # Some sales rates don't equal 1 result$q # the purchase matrix A %*% diag(result$z)
A <- matrix(c( 0.05, 0.05, 0.1, 0.1, 0, 0.1, 0, 0.15, 0.05 ), 3, 3, TRUE) S <- diag(3) # a market-clearing price vector p <- c(0.6, 0.9, 1) result <- F_Z(A, p, S) # Each sales rate is equal to 1 result$q # the purchase matrix A %*% diag(result$z) # a non-market-clearing price vector p <- c(1, 1, 1) result <- F_Z(A, p, S) # Some sales rates don't equal 1 result$q # the purchase matrix A %*% diag(result$z)
This function computes the instantaneous equilibrium path (alias market clearing path).
iep(A.iep = NULL, A = NULL, B.iep = NULL, B = NULL, SExg.iep, InitialEndowments, nPeriods.iep, ...)
iep(A.iep = NULL, A = NULL, B.iep = NULL, B = NULL, SExg.iep, InitialEndowments, nPeriods.iep, ...)
A.iep |
A.iep(state.iep) is a function which returns a demand coefficient matrix or a function A(state). state.iep is a list consisting of time (the iep time), p (the price vector at the iep time), z (output and utility vector at the iep time). |
A |
a demand coefficient matrix or a function A(state) which returns a demand coefficient matrix. If A.iep is not NULL, A will be ignored. |
B.iep |
B.iep(state.iep) is a function which returns a supply coefficient matrix or a function B(state) at the iep time. |
B |
a supply coefficient matrix or a function B(state) which returns a supply coefficient matrix. If B.iep is not NULL, B will be ignored. |
SExg.iep |
an exogenous supply matrix or a function SExg.iep(state.iep) which returns an exogenous supply matrix at the iep time. |
InitialEndowments |
a matrix indicating the initial endowments. |
nPeriods.iep |
number of periods of the instantaneous equilibrium path. |
... |
parameters of the function sdm. |
This function computes the instantaneous equilibrium path (alias market clearing path) of a dynamic economy with the structural dynamic model (the sdm function).
a list of general equilibria.
LI Wu <[email protected]>
Acemoglu, D. (2009, ISBN: 9780691132921) Introduction to Modern Economic Growth. Princeton University Press.
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
LI Wu (2010) A Structural Growth Model and its Applications to Sraffa's System. http://www.iioa.org/conferences/18th/papers/files/104_20100729011_AStructuralGrowthModelanditsApplicationstoSraffasSstem.pdf
Torres, Jose L. (2016, ISBN: 9781622730452). Introduction to Dynamic Macroeconomic General Equilibrium Models (Second Edition). Vernon Press.
## example 6.4 of Acemoglu (2009, page 206) discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 A <- function(state) { a1 <- CD_A( 1, rbind(0.35, 0.65, 0), c(state$p[1] * (1 + return.rate), state$p[2:3]) ) a2 <- c(1, 0, 0) a1[3] <- state$p[1] * a1[1] * return.rate / state$p[3] cbind(a1, a2) } B <- matrix(c( 1, 0, 0, 1, 0, 1 ), 3, 2, TRUE) SExg.iep <- { tmp <- matrix(NA, 3, 2) tmp[2, 2] <- tmp[3, 2] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 3, 2) tmp[1, 1] <- 0.01 tmp[2, 2] <- tmp[3, 2] <- 1 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 50 ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") z[1:49, 1] * (1 - 0.97 * 0.35) # the same as z[-1,2] (i.e. consumption) # stochastic (instantaneous) equilibrium path (SEP) in the economy above. nPeriods.iep <- 150 set.seed(1) alpha.SEP <- rep(1, 50) for (t in 51:nPeriods.iep) { alpha.SEP[t] <- exp(0.95 * log(alpha.SEP[t - 1]) + rnorm(1, sd = 0.01)) } A.iep <- function(state.iep) { A <- function(state) { a1 <- CD_A( alpha.SEP[state.iep$time], rbind(0.35, 0.65, 0), c(state$p[1] * (1 + return.rate), state$p[2:3]) ) a2 <- c(1, 0, 0) a1[3] <- state$p[1] * a1[1] * return.rate / state$p[3] cbind(a1, a2) } return(A) } ge.list <- iep( A.iep = A.iep, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = nPeriods.iep ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") ## an example with two firms sigma <- 0 # 0 implies Cobb-Douglas production functions gamma1 <- 0.01 gamma2 <- 0.01 gamma3 <- 0.01 beta1 <- 0.35 beta2 <- 0.4 A.iep <- function(state.iep) { A <- function(state) { a1 <- CES_A(sigma, exp(gamma1 * (state.iep$time - 1)), rbind(beta1, 0, 1 - beta1), state$p) a2 <- CES_A(sigma, exp(gamma2 * (state.iep$time - 1)), rbind(beta2, 0, 1 - beta2), state$p) a3 <- c(0, 1, 0) cbind(a1, a2, a3) } return(A) } B <- diag(3) SExg.iep <- function(state.iep) { tmp <- matrix(NA, 3, 3) tmp[3, 3] <- exp(gamma3 * (state.iep$time - 1)) tmp } InitialEndowments <- { tmp <- matrix(0, 3, 3) tmp[1, 1] <- 0.01 tmp[2, 2] <- 0.02 tmp[3, 3] <- 1 tmp } ge.list <- iep( A.iep = A.iep, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 100, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) # outputs and utility matplot(z, type = "l") diff(log(z)) # logarithmic growth rate ## an example with heterogeneous firms A <- function(state) { a1 <- CD_A(1, rbind(0.35, 0.65), state$p) a2 <- CD_A(1.3, rbind(0.9, 0.1), state$p) a3 <- c(1, 0) cbind(a1, a2, a3) } B <- matrix(c( 1, 1, 0, 0, 0, 1 ), 2, 3, TRUE) SExg.iep <- { tmp <- matrix(NA, 2, 3) tmp[2, 3] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 2, 3) tmp[1, 1] <- tmp[1, 2] <- 0.01 tmp[2, 3] <- 1 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 200, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") ## an iep of the example (see Table 2.1 and 2.2) of the canonical dynamic ## macroeconomic general equilibrium model in Torres (2016). discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 depreciation.rate <- 0.06 A <- function(state) { a1 <- CD_A(1, rbind(0, 0.65, 0.35, 0), state$p) a2 <- CD_A(1, rbind(0.4, 1 - 0.4, 0, 0), state$p) a3 <- c(1, 0, 0, state$p[1] * return.rate / state$p[4]) cbind(a1, a2, a3) } B <- matrix(c( 1, 0, 1 - depreciation.rate, 0, 1, 0, 0, 0, 1, 0, 1, 0 ), 4, 3, TRUE) SExg.iep <- { tmp <- matrix(NA, 4, 3) tmp[2, 2] <- tmp[4, 2] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 4, 3) tmp[1, 1] <- 0.01 tmp[2, 2] <- tmp[4, 2] <- 1 tmp[3, 3] <- 0.01 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 200, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") ## another iep of the economy above discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 depreciation.rate <- 0.06 A <- function(state) { a1 <- CD_A( 1, rbind(0.35, 0.65, 0), c(state$p[1] * (return.rate + depreciation.rate), state$p[2:3]) ) a2 <- CD_A(1, rbind(0.4, 1 - 0.4, 0), state$p) a1[3] <- state$p[1] * a1[1] * return.rate / state$p[3] cbind(a1, a2) } B <- function(state) { tmp <- matrix(c( 1, 0, 0, 1, 0, 1 ), 3, 2, TRUE) tmp[1] <- tmp[1] + A(state)[1, 1] * (1 - depreciation.rate) tmp } SExg.iep <- { tmp <- matrix(NA, 3, 2) tmp[2, 2] <- tmp[3, 2] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 3, 2) tmp[1, 1] <- 0.01 tmp[2, 2] <- tmp[3, 2] <- 1 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 100, n = 3, m = 2, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") ## TFP shock in the economy above (see Torres, 2016, section 2.8). nPeriods.iep <- 200 discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 depreciation.rate <- 0.06 set.seed(1) alpha.shock <- rep(1, 100) alpha.shock[101] <- exp(0.01) for (t in 102:nPeriods.iep) { alpha.shock[t] <- exp(0.95 * log(alpha.shock[t - 1])) } A.iep <- function(state.iep) { A <- function(state) { a1 <- CD_A( alpha.shock[state.iep$time], rbind(0.35, 0.65, 0), c(state$p[1] * (return.rate + depreciation.rate), state$p[2:3]) ) a2 <- CD_A(1, rbind(0.4, 1 - 0.4, 0), state$p) a1[3] <- state$p[1] * a1[1] * return.rate / state$p[3] cbind(a1, a2) } return(A) } B.iep <- function(state.iep) { B <- function(state) { tmp <- matrix(c( 1, 0, 0, 1, 0, 1 ), 3, 2, TRUE) a1 <- CD_A( alpha.shock[state.iep$time], rbind(0.35, 0.65, 0), c(state$p[1] * (return.rate + depreciation.rate), state$p[2:3]) ) tmp[1] <- tmp[1] + a1[1] * (1 - depreciation.rate) tmp } return(B) } SExg.iep <- { tmp <- matrix(NA, 3, 2) tmp[2, 2] <- tmp[3, 2] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 3, 2) tmp[1, 1] <- tmp[2, 2] <- tmp[3, 2] <- 1 tmp } ge.list <- iep( A.iep = A.iep, B.iep = B.iep, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = nPeriods.iep, n = 3, m = 2, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) c <- sapply(ge.list, function(x) x$A[1,2]*x$z[2]) #consumption par(mfrow = c(2, 2)) matplot(z, type = "l") x <- 100:140 plot(x, z[x, 1] / z[x[1], 1], type = "b", pch = 20) plot(x, z[x, 2] / z[x[1], 2], type = "b", pch = 20) plot(x, c[x] / c[x[1]], type = "b", pch = 20) ## an iep of example 7.2 (a monetary economy) in Li (2019). A <- function(state) { alpha <- rbind(1, 1, 1) Beta <- matrix(c( 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -1, -1, -1 ), 3, 3, TRUE) CD_mA(alpha, Beta, state$p) } B <- diag(3) SExg.iep <- { tmp <- matrix(NA, 3, 3) tmp[2, 2] <- 100 tmp[3, 3] <- 100 tmp } InitialEndowments <- { tmp <- matrix(0, 3, 3) tmp[1, 1] <- 10 tmp[2, 2] <- tmp[3, 3] <- 100 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 20, moneyIndex = 3, moneyOwnerIndex = 3, pExg = rbind(NA, NA, 0.25) ) par(mfrow = c(1, 2)) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "b", pch = 20) p <- t(sapply(ge.list, function(x) x$p)) matplot(p, type = "b", pch = 20) ## an example of structural transition policy A.iep <- function(state.iep) { a <- 15 b <- 25 A <- function(state) { alpha1 <- 5 alpha2 <- 15 if (state.iep$time == 1 || state.iep$z[1] <= a) { alpha <- alpha1 } else if (state.iep$z[1] > b) { alpha <- alpha2 } else { alpha <- (b - state.iep$z[1]) / (b - a) * alpha1 + (state.iep$z[1] - a) / (b - a) * alpha2 } return(cbind( CD_A(alpha, c(0.5, 0.5), state$p), c(1, 0) )) } return(A) } B <- matrix(c( 1, 0, 0, 1 ), 2, 2, TRUE) SExg.iep <- function(state.iep) { if (state.iep$time >= 15 && state.iep$z[1] < 30) { result <- matrix(c( NA, NA, 0.6, 0.4 ), 2, 2, TRUE) } else { result <- matrix(c( NA, NA, 0, 1 ), 2, 2, TRUE) } return(result) } InitialEndowments <- { tmp <- matrix(0, 2, 2) tmp[1, 1] <- 1 tmp[2, 2] <- 1 tmp } ge.list <- iep( A.iep = A.iep, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 30, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "b", pch = 20)
## example 6.4 of Acemoglu (2009, page 206) discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 A <- function(state) { a1 <- CD_A( 1, rbind(0.35, 0.65, 0), c(state$p[1] * (1 + return.rate), state$p[2:3]) ) a2 <- c(1, 0, 0) a1[3] <- state$p[1] * a1[1] * return.rate / state$p[3] cbind(a1, a2) } B <- matrix(c( 1, 0, 0, 1, 0, 1 ), 3, 2, TRUE) SExg.iep <- { tmp <- matrix(NA, 3, 2) tmp[2, 2] <- tmp[3, 2] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 3, 2) tmp[1, 1] <- 0.01 tmp[2, 2] <- tmp[3, 2] <- 1 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 50 ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") z[1:49, 1] * (1 - 0.97 * 0.35) # the same as z[-1,2] (i.e. consumption) # stochastic (instantaneous) equilibrium path (SEP) in the economy above. nPeriods.iep <- 150 set.seed(1) alpha.SEP <- rep(1, 50) for (t in 51:nPeriods.iep) { alpha.SEP[t] <- exp(0.95 * log(alpha.SEP[t - 1]) + rnorm(1, sd = 0.01)) } A.iep <- function(state.iep) { A <- function(state) { a1 <- CD_A( alpha.SEP[state.iep$time], rbind(0.35, 0.65, 0), c(state$p[1] * (1 + return.rate), state$p[2:3]) ) a2 <- c(1, 0, 0) a1[3] <- state$p[1] * a1[1] * return.rate / state$p[3] cbind(a1, a2) } return(A) } ge.list <- iep( A.iep = A.iep, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = nPeriods.iep ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") ## an example with two firms sigma <- 0 # 0 implies Cobb-Douglas production functions gamma1 <- 0.01 gamma2 <- 0.01 gamma3 <- 0.01 beta1 <- 0.35 beta2 <- 0.4 A.iep <- function(state.iep) { A <- function(state) { a1 <- CES_A(sigma, exp(gamma1 * (state.iep$time - 1)), rbind(beta1, 0, 1 - beta1), state$p) a2 <- CES_A(sigma, exp(gamma2 * (state.iep$time - 1)), rbind(beta2, 0, 1 - beta2), state$p) a3 <- c(0, 1, 0) cbind(a1, a2, a3) } return(A) } B <- diag(3) SExg.iep <- function(state.iep) { tmp <- matrix(NA, 3, 3) tmp[3, 3] <- exp(gamma3 * (state.iep$time - 1)) tmp } InitialEndowments <- { tmp <- matrix(0, 3, 3) tmp[1, 1] <- 0.01 tmp[2, 2] <- 0.02 tmp[3, 3] <- 1 tmp } ge.list <- iep( A.iep = A.iep, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 100, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) # outputs and utility matplot(z, type = "l") diff(log(z)) # logarithmic growth rate ## an example with heterogeneous firms A <- function(state) { a1 <- CD_A(1, rbind(0.35, 0.65), state$p) a2 <- CD_A(1.3, rbind(0.9, 0.1), state$p) a3 <- c(1, 0) cbind(a1, a2, a3) } B <- matrix(c( 1, 1, 0, 0, 0, 1 ), 2, 3, TRUE) SExg.iep <- { tmp <- matrix(NA, 2, 3) tmp[2, 3] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 2, 3) tmp[1, 1] <- tmp[1, 2] <- 0.01 tmp[2, 3] <- 1 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 200, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") ## an iep of the example (see Table 2.1 and 2.2) of the canonical dynamic ## macroeconomic general equilibrium model in Torres (2016). discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 depreciation.rate <- 0.06 A <- function(state) { a1 <- CD_A(1, rbind(0, 0.65, 0.35, 0), state$p) a2 <- CD_A(1, rbind(0.4, 1 - 0.4, 0, 0), state$p) a3 <- c(1, 0, 0, state$p[1] * return.rate / state$p[4]) cbind(a1, a2, a3) } B <- matrix(c( 1, 0, 1 - depreciation.rate, 0, 1, 0, 0, 0, 1, 0, 1, 0 ), 4, 3, TRUE) SExg.iep <- { tmp <- matrix(NA, 4, 3) tmp[2, 2] <- tmp[4, 2] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 4, 3) tmp[1, 1] <- 0.01 tmp[2, 2] <- tmp[4, 2] <- 1 tmp[3, 3] <- 0.01 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 200, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") ## another iep of the economy above discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 depreciation.rate <- 0.06 A <- function(state) { a1 <- CD_A( 1, rbind(0.35, 0.65, 0), c(state$p[1] * (return.rate + depreciation.rate), state$p[2:3]) ) a2 <- CD_A(1, rbind(0.4, 1 - 0.4, 0), state$p) a1[3] <- state$p[1] * a1[1] * return.rate / state$p[3] cbind(a1, a2) } B <- function(state) { tmp <- matrix(c( 1, 0, 0, 1, 0, 1 ), 3, 2, TRUE) tmp[1] <- tmp[1] + A(state)[1, 1] * (1 - depreciation.rate) tmp } SExg.iep <- { tmp <- matrix(NA, 3, 2) tmp[2, 2] <- tmp[3, 2] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 3, 2) tmp[1, 1] <- 0.01 tmp[2, 2] <- tmp[3, 2] <- 1 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 100, n = 3, m = 2, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "l") ## TFP shock in the economy above (see Torres, 2016, section 2.8). nPeriods.iep <- 200 discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 depreciation.rate <- 0.06 set.seed(1) alpha.shock <- rep(1, 100) alpha.shock[101] <- exp(0.01) for (t in 102:nPeriods.iep) { alpha.shock[t] <- exp(0.95 * log(alpha.shock[t - 1])) } A.iep <- function(state.iep) { A <- function(state) { a1 <- CD_A( alpha.shock[state.iep$time], rbind(0.35, 0.65, 0), c(state$p[1] * (return.rate + depreciation.rate), state$p[2:3]) ) a2 <- CD_A(1, rbind(0.4, 1 - 0.4, 0), state$p) a1[3] <- state$p[1] * a1[1] * return.rate / state$p[3] cbind(a1, a2) } return(A) } B.iep <- function(state.iep) { B <- function(state) { tmp <- matrix(c( 1, 0, 0, 1, 0, 1 ), 3, 2, TRUE) a1 <- CD_A( alpha.shock[state.iep$time], rbind(0.35, 0.65, 0), c(state$p[1] * (return.rate + depreciation.rate), state$p[2:3]) ) tmp[1] <- tmp[1] + a1[1] * (1 - depreciation.rate) tmp } return(B) } SExg.iep <- { tmp <- matrix(NA, 3, 2) tmp[2, 2] <- tmp[3, 2] <- 1 tmp } InitialEndowments <- { tmp <- matrix(0, 3, 2) tmp[1, 1] <- tmp[2, 2] <- tmp[3, 2] <- 1 tmp } ge.list <- iep( A.iep = A.iep, B.iep = B.iep, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = nPeriods.iep, n = 3, m = 2, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) c <- sapply(ge.list, function(x) x$A[1,2]*x$z[2]) #consumption par(mfrow = c(2, 2)) matplot(z, type = "l") x <- 100:140 plot(x, z[x, 1] / z[x[1], 1], type = "b", pch = 20) plot(x, z[x, 2] / z[x[1], 2], type = "b", pch = 20) plot(x, c[x] / c[x[1]], type = "b", pch = 20) ## an iep of example 7.2 (a monetary economy) in Li (2019). A <- function(state) { alpha <- rbind(1, 1, 1) Beta <- matrix(c( 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -1, -1, -1 ), 3, 3, TRUE) CD_mA(alpha, Beta, state$p) } B <- diag(3) SExg.iep <- { tmp <- matrix(NA, 3, 3) tmp[2, 2] <- 100 tmp[3, 3] <- 100 tmp } InitialEndowments <- { tmp <- matrix(0, 3, 3) tmp[1, 1] <- 10 tmp[2, 2] <- tmp[3, 3] <- 100 tmp } ge.list <- iep( A = A, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 20, moneyIndex = 3, moneyOwnerIndex = 3, pExg = rbind(NA, NA, 0.25) ) par(mfrow = c(1, 2)) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "b", pch = 20) p <- t(sapply(ge.list, function(x) x$p)) matplot(p, type = "b", pch = 20) ## an example of structural transition policy A.iep <- function(state.iep) { a <- 15 b <- 25 A <- function(state) { alpha1 <- 5 alpha2 <- 15 if (state.iep$time == 1 || state.iep$z[1] <= a) { alpha <- alpha1 } else if (state.iep$z[1] > b) { alpha <- alpha2 } else { alpha <- (b - state.iep$z[1]) / (b - a) * alpha1 + (state.iep$z[1] - a) / (b - a) * alpha2 } return(cbind( CD_A(alpha, c(0.5, 0.5), state$p), c(1, 0) )) } return(A) } B <- matrix(c( 1, 0, 0, 1 ), 2, 2, TRUE) SExg.iep <- function(state.iep) { if (state.iep$time >= 15 && state.iep$z[1] < 30) { result <- matrix(c( NA, NA, 0.6, 0.4 ), 2, 2, TRUE) } else { result <- matrix(c( NA, NA, 0, 1 ), 2, 2, TRUE) } return(result) } InitialEndowments <- { tmp <- matrix(0, 2, 2) tmp[1, 1] <- 1 tmp[2, 2] <- 1 tmp } ge.list <- iep( A.iep = A.iep, B = B, SExg.iep = SExg.iep, InitialEndowments = InitialEndowments, nPeriods.iep = 30, trace = FALSE ) z <- t(sapply(ge.list, function(x) x$z)) matplot(z, type = "b", pch = 20)
This function computes a Leontief monetary demand coefficient matrix in a monetary economy.
Leontief_mA(A.pre, p)
Leontief_mA(A.pre, p)
A.pre |
a numeric n-by-m matrix. |
p |
a nonnegative numeric n-vector or n-by-1 matrix. |
Some elements of A corresponding to money equal -1.
A n-by-m matrix is computed which indicates the (monetary) demand structure of agents (firms or consumers) with Leontief production functions or utility functions under the price vector p.
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
A.pre <- matrix(c( 0.5, 1, 1, 0.1, 0, 0, -1, -1, -1 ), 3, 3, TRUE) p <- c(1, 2, 0.1) Leontief_mA(A.pre, p)
A.pre <- matrix(c( 0.5, 1, 1, 0.1, 0, 0, -1, -1, -1 ), 3, 3, TRUE) p <- c(1, 2, 0.1) Leontief_mA(A.pre, p)
This function computes the P-F (i.e. Perron-Frobenius) eigenvalue and eigenvector of an indecomposable nonnegative square matrix.
PF_eig(M)
PF_eig(M)
M |
an indecomposable nonnegative square matrix. |
PF_eig returns a list containing the following components:
val |
the P-F eigenvalue of M. |
vec |
the normalized P-F eigenvector of M. |
LI Wu <[email protected]>
Horn, R. A., Johnson, C. R. (2012, ISBN: 0521548233) Matrix Analysis. Cambridge University Press.
M<-matrix(c(0.5,1, 1, 0),2,2,TRUE) PF_eig(M)
M<-matrix(c(0.5,1, 1, 0),2,2,TRUE) PF_eig(M)
This function computes the general equilibrium and simulates the economic dynamics. The key part of this function is an exchange function (see F_Z
), which is expounded in Li (2010, 2019).
sdm( A, B = diag(nrow(A)), n = nrow(B), m = ncol(B), S0Exg = matrix(NA, n, m), p0 = matrix(1, nrow = n, ncol = 1), z0 = matrix(100, nrow = m, ncol = 1), GRExg = NA, moneyOwnerIndex = NULL, moneyIndex = NULL, pExg = NULL, tolCond = 1e-5, maxIteration = 200, numberOfPeriods = 300, depreciationCoef = 0.8, thresholdForPriceAdjustment = 0.99, priceAdjustmentMethod = "variable", priceAdjustmentVelocity = 0.15, trace = TRUE, ts = FALSE, policy = NULL, exchangeFunction = F_Z )
sdm( A, B = diag(nrow(A)), n = nrow(B), m = ncol(B), S0Exg = matrix(NA, n, m), p0 = matrix(1, nrow = n, ncol = 1), z0 = matrix(100, nrow = m, ncol = 1), GRExg = NA, moneyOwnerIndex = NULL, moneyIndex = NULL, pExg = NULL, tolCond = 1e-5, maxIteration = 200, numberOfPeriods = 300, depreciationCoef = 0.8, thresholdForPriceAdjustment = 0.99, priceAdjustmentMethod = "variable", priceAdjustmentVelocity = 0.15, trace = TRUE, ts = FALSE, policy = NULL, exchangeFunction = F_Z )
A |
a demand coefficient n-by-m matrix (alias demand structure matrix) or a function A(state) which returns an n-by-m matrix. |
B |
a supply coefficient n-by-m matrix (alias supply structure matrix) or a function which returns an n-by-m matrix. If (i,j)-th element of S0Exg is not NA, the value of the (i,j)-th element of B will be useless and ignored. |
n |
the number of commodities. |
m |
the number of economic agents (or sectors). |
S0Exg |
an initial exogenous supply n-by-m matrix. This matrix may contain NA, but not zero. |
p0 |
an initial price n-vector. |
z0 |
an m-vector consisting of the initial exchange levels (i.e. activity levels, production levels or utility levels). |
GRExg |
an exogenous growth rate of the exogenous supplies in S0Exg. If GRExg is NA and some commodities have exogenous supply, then GRExg will be set to 0. |
moneyOwnerIndex |
a vector consisting of the indices of agents supplying money. |
moneyIndex |
a vector consisting of the commodity indices of all types of money. |
pExg |
an n-vector indicating the exogenous prices (if any). |
tolCond |
the tolerance condition. |
maxIteration |
the maximum iteration count. If the main purpose of running this function is to do simulation instead of calculating equilibrium, then maxIteration should be set to 1. |
numberOfPeriods |
the period number in each iteration. |
depreciationCoef |
the depreciation coefficient (i.e. 1 minus the depreciation rate) of the unsold products. |
thresholdForPriceAdjustment |
the threshold for the fixed percentage price adjustment method. |
priceAdjustmentMethod |
the price adjustment method. Normally it should be set to "variable". If it is set to "fixed", a fixed percentage price adjustment method will be used. |
priceAdjustmentVelocity |
the price adjustment velocity. |
trace |
if TRUE, information is printed during the running of sdm. |
ts |
if TRUE, the time series of the last iteration are returned. |
policy |
a policy function. |
exchangeFunction |
the exchange function. |
The parameters A may be a function A(state) wherein state is a list consisting of p (the price vector), z (the output and utility vector), w (the wealth vector), t (the time) and e (the foreign exchange rate vector if any). state indicates the states at time t.
The parameters B also may be a function B(state) wherein state is a list consisting of p (the price vector), z (the output and utility vector) and t (the time).
sdm returns a list containing the following components:
tolerance |
the tolerance of the results. |
p |
equilibrium prices. |
z |
equilibrium exchange levels (i.e. activity levels, output levels or utility levels). |
S |
the equilibrium supply matrix at the initial period. |
e |
equilibrium foreign exchange rates in a multi-money economy. |
growthRate |
the endogenous equilibrium growth rate in a pure production economy. |
A |
the equilibrium demand coefficient matrix. |
B |
If B is a function, the equilibrium supply coefficient matrix is returned. |
ts.p |
the time series of prices in the last iteration. |
ts.z |
the time series of exchange levels (i.e. activity levels, production levels or utility levels) in the last iteration. |
ts.S |
the time series of supply matrix in the last iteration. |
ts.q |
the time series of sales rates in the last iteration. |
ts.e |
the time series of foreign exchange rates in the last iteration. |
policy.data |
the policy data. |
LI Wu <[email protected]>
LI Wu (2019, ISBN: 9787521804225) General Equilibrium and Structural Dynamics: Perspectives of New Structural Economics. Beijing: Economic Science Press. (In Chinese)
LI Wu (2010) A Structural Growth Model and its Applications to Sraffa's System. http://www.iioa.org/conferences/18th/papers/files/104_20100729011_AStructuralGrowthModelanditsApplicationstoSraffasSstem.pdf
Torres, Jose L. (2016, ISBN: 9781622730452) Introduction to Dynamic Macroeconomic General Equilibrium Models (Second Edition). Vernon Press.
Varian, Hal R. (1992, ISBN: 0393957357) Microeconomic Analysis. W. W. Norton & Company.
iep
;
Example2.2
;
Example2.3
;
Example.Section.3.1.2.corn
;
Example3.1
;
Example3.2
;
Example3.4
;
Example3.8
;
Example3.9
;
Example3.10
;
Example3.12
;
Example3.14
;
Example4.2
;
Example4.8
;
Example4.9
;
Example4.10
;
Example4.11.1
;
Example4.11.2
;
Example4.12
;
Example4.13
;
Example4.15
;
Example4.16
;
Example5.1
;
Example5.2
;
Example5.3.2
;
Example5.4
;
Example5.5
;
Example5.6
;
Example5.10
;
Example5.11.1
;
Example5.11.2
;
Example6.2.1
;
Example6.2.2
;
Example6.3
;
Example6.4
;
Example6.5
;
Example6.6.1
;
Example6.6.2
;
Example6.6.3
;
Example6.7
;
Example6.9
;
Example6.10
;
Example6.11
;
Example7.1
;
Example7.2
;
Example7.3
;
Example7.4
;
Example7.5.1
;
Example7.5.2
;
Example7.6
;
Example7.7
;
Example7.8
;
Example7.9X
;
Example7.10
;
Example7.10.2
;
Example7.11
;
Example7.12
;
Example7.13
;
Example7.14
;
Example7.15
;
Example8.1
;
Example8.2
;
Example8.7
;
Example8.8
;
Example8.9
;
Example9.3
;
Example9.4
;
Example9.5
;
Example9.6
;
Example9.7
;
Example9.10
;
## the example on page 352 in Varian (1992) ge <- sdm( A = function(state) { a <- 0.5 alpha <- rep(1, 3) Beta <- matrix(c(0, a, a, 0.5, 0, 0, 0.5, 1 - a, 1 - a), 3, 3, TRUE) #the demand coefficient matrix. CD_A(alpha, Beta, state$p) }, B = diag(3), S0Exg = matrix(c(NA, NA, NA, NA, 1, NA, NA, NA, 1), 3, 3, TRUE), GRExg = 0, tolCond = 1e-10 ) ge$p/ge$p[1] ## the example (see Table 2.1 and 2.2) of the canonical dynamic ## macroeconomic general equilibrium model in Torres (2016). discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 depreciation.rate <- 0.06 ge <- sdm( n = 4, m = 3, A = function(state) { a1 <- CD_A(1, rbind(0, 0.65, 0.35, 0), state$p) a2 <- CD_A(1, rbind(0.4, 1 - 0.4, 0, 0), state$p) a3 <- c(1, 0, 0, state$p[1] * return.rate / state$p[4]) cbind(a1, a2, a3) }, B = matrix(c( 1, 0, 1 - depreciation.rate, 0, 1, 0, 0, 0, 1, 0, 1, 0 ), 4, 3, TRUE), S0Exg = { tmp <- matrix(NA, 4, 3) tmp[2, 2] <- 1 tmp[4, 2] <- 1 tmp }, priceAdjustmentVelocity = 0.03, maxIteration = 1, numberOfPeriods = 5000, ts = TRUE ) ge$A %*% diag(ge$z) # the demand matrix ge$p / ge$p[1] plot(ge$ts.z[, 1], type = "l")
## the example on page 352 in Varian (1992) ge <- sdm( A = function(state) { a <- 0.5 alpha <- rep(1, 3) Beta <- matrix(c(0, a, a, 0.5, 0, 0, 0.5, 1 - a, 1 - a), 3, 3, TRUE) #the demand coefficient matrix. CD_A(alpha, Beta, state$p) }, B = diag(3), S0Exg = matrix(c(NA, NA, NA, NA, 1, NA, NA, NA, 1), 3, 3, TRUE), GRExg = 0, tolCond = 1e-10 ) ge$p/ge$p[1] ## the example (see Table 2.1 and 2.2) of the canonical dynamic ## macroeconomic general equilibrium model in Torres (2016). discount.factor <- 0.97 return.rate <- 1 / discount.factor - 1 depreciation.rate <- 0.06 ge <- sdm( n = 4, m = 3, A = function(state) { a1 <- CD_A(1, rbind(0, 0.65, 0.35, 0), state$p) a2 <- CD_A(1, rbind(0.4, 1 - 0.4, 0, 0), state$p) a3 <- c(1, 0, 0, state$p[1] * return.rate / state$p[4]) cbind(a1, a2, a3) }, B = matrix(c( 1, 0, 1 - depreciation.rate, 0, 1, 0, 0, 0, 1, 0, 1, 0 ), 4, 3, TRUE), S0Exg = { tmp <- matrix(NA, 4, 3) tmp[2, 2] <- 1 tmp[4, 2] <- 1 tmp }, priceAdjustmentVelocity = 0.03, maxIteration = 1, numberOfPeriods = 5000, ts = TRUE ) ge$A %*% diag(ge$z) # the demand matrix ge$p / ge$p[1] plot(ge$ts.z[, 1], type = "l")