# \donttest{
gemCanonicalDynamicMacroeconomic_3_2()
#### (A) A spot equilibrium path.
ge <- gemCanonicalDynamicMacroeconomic_3_2(
policy.price = policyMarketClearingPrice,
ts = TRUE,
maxIteration = 1,
numberOfPeriods = 100,
z0 = c(50, 100)
)
par(mfrow = c(1, 2))
matplot(ge$ts.z, type = "o", pch = 20)
matplot(ge$ts.p, type = "o", pch = 20)
#### (B) Technology change in a spot equilibrium path.
policyTechnologyChange <- function(time, A) {
alpha <- 1.2 # The original value is 1.
time.win <- c(50, 50)
discount.factor <- 0.97
depreciation.rate <- 0.06
beta.prod.firm <- 0.35
return.rate <- 1 / discount.factor - 1
if (time >= time.win[1] && time <= time.win[2]) {
A[[1]]$func <- function(p) {
result <- CD_A(
alpha, rbind(beta.prod.firm , 1 - beta.prod.firm , 0),
c(p[1] * (return.rate + depreciation.rate), p[2:3])
)
result[3] <- p[1] * result[1] * return.rate / p[3]
result
}
}
}
ge <- gemCanonicalDynamicMacroeconomic_3_2(
policy.technology = policyTechnologyChange,
policy.price = policyMarketClearingPrice,
ts = TRUE,
maxIteration = 1,
numberOfPeriods = 100,
z0 = c(50, 100)
)
par(mfrow = c(1, 2))
matplot(ge$ts.z, type = "o", pch = 20)
matplot(ge$ts.p, type = "o", pch = 20)
#### (C) An example on page 46 in Li Xiangyang (2018).
ge <- gemCanonicalDynamicMacroeconomic_3_2(
discount.factor = 0.99,
depreciation.rate = 0.025,
beta.prod.firm = 0.36,
beta.prod.consumer = 1
)
# }
Run the code above in your browser using DataLab