Description Usage Arguments Details Value Author(s) References See Also Examples
This function computes the instantaneous equilibrium path (alias market clearing path).
1 2 |
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 <liwu@staff.shu.edu.cn>
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.