# \donttest{
#### Take the wage postpayment assumption.
ge <- gemCanonicalDynamicMacroeconomic_Timeline_2_2()
np <- 5
eis <- 1
Gamma.beta <- 0.97
gr <- 0
ge$p
ge$p[1:(np - 1)] / ge$p[2:np] - 1
ge$p[(np + 1):(2 * np - 2)] / ge$p[(np + 2):(2 * np - 1)] - 1
sserr(eis = eis, Gamma.beta = Gamma.beta, gr = gr) # the steady-state equilibrium return rate
ge$z
ge$D
node_plot(ge$dst.consumer, TRUE)
#### Take the wage postpayment assumption.
eis <- 0.8
Gamma.beta <- 0.97
gr <- 0.03
ge <- gemCanonicalDynamicMacroeconomic_Timeline_2_2(
es.prod.lab.firm = 0.8,
eis = eis, Gamma.beta = Gamma.beta, es.prod.lab.consumer = 0.8,
gr = gr
)
np <- 5
ge$p
growth_rate(ge$p[1:np])
1 / (1 + sserr(eis = eis, Gamma.beta = Gamma.beta, gr = gr)) - 1
ge$z
growth_rate(ge$z[1:(np - 1)])
ge$D
ge$S
##### a fully anticipated technology shock.
## Warning: Running the program below takes several minutes.
# np <- 120
# alpha.firm <- rep(1, np - 1)
# alpha.firm[40] <- 1.05
# ge <- gemCanonicalDynamicMacroeconomic_Timeline_2_2(alpha.firm = alpha.firm)
#
## The steady state product supply is 343.92.
## the (economic) time series of product supply.
# plot(ge$z[1:(np - 1)] / 343.92 - 1, type = "o", pch = 20)
## The steady state product consumption is 57.27.
## the (economic) time series of product consumption.
# plot(ge$D[2:(np - 1), np] / 57.27 - 1, type = "o", pch = 20)
# plot(growth_rate(ge$p[1:(np)]), type = "o", pch = 20)
# plot(growth_rate(ge$p[(np + 1):(2 * np)]), type = "o", pch = 20)
#
##### an unanticipated technology shock.
# np <- 50
# alpha.firm <- rep(1, np - 1)
# alpha.firm[1] <- 1.05
# ge <- gemCanonicalDynamicMacroeconomic_Timeline_2_2(
# alpha.firm = alpha.firm,
# initial.product.supply = 286.6341, # the steady state value
# head.tail.adjustment = "tail"
# )
#
## The steady state product supply is 343.92.
## the (economic) time series of product supply.
# plot(ge$z[1:(np - 1)] / 343.92 - 1, type = "o", pch = 20)
## The steady state product consumption is 57.27.
## the (economic) time series of product consumption.
# plot(ge$D[2:(np - 1), np] / 57.27 - 1, type = "o", pch = 20)
# plot(growth_rate(ge$p[1:(np)]), type = "o", pch = 20)
# plot(growth_rate(ge$p[(np + 1):(2 * np)]), type = "o", pch = 20)
#
### a technology shock anticipated several periods in advance.
# np <- 50
# alpha.firm <- rep(1, np - 1)
# alpha.firm[5] <- 1.05
# ge5 <- gemCanonicalDynamicMacroeconomic_Timeline_2_2(
# alpha.firm = alpha.firm,
# initial.product.supply = 286.6341, # the steady state value
# head.tail.adjustment = "tail"
# )
#
## The steady state product supply is 343.92.
## the (economic) time series of product supply
# plot(ge5$z[1:(np - 1)] / 343.92 - 1, type = "o", pch = 20)
## The steady state product consumption is 57.27.
## the (economic) time series of product consumption
# plot(ge5$D[2:(np - 1), np] / 57.27 - 1, type = "o", pch = 20)
# plot(growth_rate(ge5$p[1:(np)]), type = "o", pch = 20)
# plot(growth_rate(ge5$p[(np + 1):(2 * np)]), type = "o", pch = 20)
#
# alpha.firm <- rep(1, np - 1)
# alpha.firm[10] <- 1.05
# ge10 <- gemCanonicalDynamicMacroeconomic_Timeline_2_2(
# alpha.firm = alpha.firm,
# initial.product.supply = 286.6341, # the steady state value
# head.tail.adjustment = "tail"
# )
# plot(ge$z[1:(np - 1)] / 343.92 - 1, type = "o", pch = 20, ylim = c(-0.005, 0.017))
# lines(ge5$z[1:(np - 1)] / 343.92 - 1, type = "o", pch = 21)
# lines(ge10$z[1:(np - 1)] / 343.92 - 1, type = "o", pch = 22)
##### an unanticipated technology shock.
## Warning: Running the program below takes several minutes.
# np <- 100
# alpha.firm <- exp(0.01)
# for (t in 2:(np - 1)) {
# alpha.firm[t] <- exp(0.9 * log(alpha.firm[t - 1]))
# }
# plot(alpha.firm)
#
# ge <- gemCanonicalDynamicMacroeconomic_Timeline_2_2(
# alpha.firm = alpha.firm,
# initial.product.supply = 286.6341, # the steady state value
# head.tail.adjustment = "tail"
# )
#
## The steady state product supply is 343.92.
## the (economic) time series of product supply
# plot(ge$z[1:(np - 1)] / 343.92 - 1, type = "o", pch = 20)
## The steady state product consumption is 57.27.
## the (economic) time series of product consumption
# plot(ge$D[2:(np - 1), np] / 57.27 - 1, type = "o", pch = 20)
# plot(growth_rate(ge$p[1:(np)]), type = "o", pch = 20)
# plot(growth_rate(ge$p[(np + 1):(2 * np)]), type = "o", pch = 20)
#### Take the wage prepayment assumption.
ge <- gemCanonicalDynamicMacroeconomic_Timeline_2_2(wage.payment = "pre")
np <- 5
eis <- 1
Gamma.beta <- 0.97
gr <- 0
ge$p
ge$p[1:(np - 1)] / ge$p[2:np] - 1
ge$p[(np + 1):(2 * np - 2)] / ge$p[(np + 2):(2 * np - 1)] - 1
sserr(eis = eis, Gamma.beta = Gamma.beta, gr = gr) # the steady-state equilibrium return rate
ge$z
ge$D
node_plot(ge$dst.consumer, TRUE)
#### Take the wage prepayment assumption.
np <- 5
eis <- 0.8
Gamma.beta <- 0.97
gr <- 0.03
ge <- gemCanonicalDynamicMacroeconomic_Timeline_2_2(
es.prod.lab.firm = 0.8,
eis = eis, Gamma.beta = Gamma.beta, es.prod.lab.consumer = 0.8,
gr = gr,
wage.payment = "pre"
)
ge$p
growth_rate(ge$p[1:np])
1 / (1 + sserr(eis = eis, Gamma.beta = Gamma.beta, gr = gr)) - 1
ge$z
growth_rate(ge$z[1:(np - 1)])
ge$D
ge$S
# }
Run the code above in your browser using DataLab