# NOT RUN {
dst.firm <- node_new("output",
type = "CD", alpha = 5,
beta = c(0.5, 0.5),
"prod", "lab"
)
dst.consumer <- node_new("utility",
type = "CD", alpha = 1,
beta = c(0.5, 0.5),
"prod", "lab"
)
f <- function(pExg = NULL, policy = NULL) {
ge <- sdm2(
A = list(dst.firm, dst.consumer),
B = diag(c(1, 0), 2, 2),
S0Exg = {
S0Exg <- matrix(NA, 2, 2)
S0Exg[2, 2] <- 100
S0Exg
},
names.commodity = c("prod", "lab"),
names.agent = c("firm", "consumer"),
numeraire = "lab",
maxIteration = 1,
numberOfPeriods = 100,
p0 = c(0.16, 1),
ts = TRUE,
pExg = pExg,
policy = policy
)
print(ge$p)
print(ge$z)
par(mfrow = c(1, 2))
matplot(ge$ts.p, type = "l")
matplot(ge$ts.z, type = "l")
ge
}
## No price regulation policy.
f()
## Set the market prices to the steady equilibrium prices from the beginning.
## The labor market keeps oversupplied.
result <- f(pExg = c(0.16, 1))
matplot(result$ts.q, type = "l") # sale rates
## the same as above
f(policy = function(state) {
state$p <- c(0.16, 1)
state
})
## The price regulation policy is implemented from the tenth period.
f(policy = function(time, state) {
if (time >= 10) state$p <- c(0.16, 1)
state
})
# }
Run the code above in your browser using DataLab