# \donttest{
#### (A) A spot equilibrium path that converges to the steady-state equilibrium.
ge <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = 100,
policy = policyMarketClearingPrice
)
matplot(ge$ts.z, type = "o", pch = 20)
matplot(ge$ts.p, type = "o", pch = 20)
## population growth: a spot equilibrium path
## that converges to a balanced growth path
ge <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = 100,
GRExg = 0.01,
policy = policyMarketClearingPrice
)
matplot((ge$ts.p), type = "l")
matplot((ge$ts.z), type = "l")
matplot(growth_rate(ge$ts.z), type = "l")
#### (B) A disequilibrium path and the steady-state equilibrium.
ge <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = 5000,
priceAdjustmentVelocity = 0.03,
)
ge$p
ge$z
matplot(ge$ts.z, type = "l")
node_plot(ge$dstl[[3]], param = TRUE)
## a small disturbance to the product supply
ge <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = 4000,
priceAdjustmentVelocity = 0.03,
policy = function(time, state) {
if (time == 1500) {
state$S[1, 1] <- state$S[1, 1] * 0.999
}
state
}
)
#### (C) Business cycles.
de <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = 1000,
priceAdjustmentVelocity = 0.15
)
## A tax rate policy is implemented from the 600th period to stabilize the economy.
ge <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = 1500,
priceAdjustmentVelocity = 0.15,
policy = Example9.10.policy.tax
)
matplot(ge$ts.z, type = "l")
plot(ge$policy.data, type = "l") # tax rates
#### (D) A spot equilibrium path with a productivity shock.
nPeriod <- 100 # the number of periods of the spot equilibrium path
set.seed(1)
alpha.shock <- rep(1, nPeriod)
alpha.shock[11] <- exp(0.01)
for (t in 12:nPeriod) {
alpha.shock[t] <- exp(0.95 * log(alpha.shock[t - 1]))
}
plot(alpha.shock)
ge <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = nPeriod,
p0 = c(1, 1.34312, 0.09093, 0.08865),
z0 = c(74.47, 61.20, 286.65),
policy = list(
function(time, A) {
A[[1]]$alpha <- alpha.shock[time]
},
policyMarketClearingPrice
)
)
matplot(ge$ts.z[, 1], type = "o", pch = 20)
# }
Run the code above in your browser using DataLab