# \donttest{
#### a market-clearing path that converges to the steady-state equilibrium
ge <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = 100,
policy = policyMarketClearingPrice,
z0 = c(1, 1, 1)
)
matplot(ge$ts.z, type = "o", pch = 20)
matplot(ge$ts.p, type = "o", pch = 20)
## population growth: a market-clearing path
## that converges a balanced growth path
ge <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = 100,
GRExg = 0.01,
z0 = c(1, 1, 1),
policy = policyMarketClearingPrice
)
matplot((ge$ts.p), type = "l")
matplot((ge$ts.z), type = "l")
matplot(growth_rate(ge$ts.z), type = "l")
#### a disequilibrium path and the steady-state equilibrium
ge <- gemCanonicalDynamicMacroeconomic_4_3(
numberOfPeriods = 5000,
priceAdjustmentVelocity = 0.03,
z0 = c(1, 1, 1)
)
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,
z0 = c(1, 1, 1),
policy = function(time, state) {
if (time == 1500) {
state$S[1, 1] <- state$S[1, 1] * 0.999
}
state
}
)
#### business cycle
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
#### a market-clearing path with a productivity shock
nPeriod <- 100 # the number of periods of the market-clearing 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(0.7447, 0.6120, 2.8665),
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