# NOT RUN {
f <- function(stickiness.firm = 0) {
dst.firm <- node_new("output",
type = "Leontief", a = c(1 - stickiness.firm, stickiness.firm),
"cc1", "cc2"
)
node_set(dst.firm, "cc1",
type = "CD", alpha = 5,
beta = c(0.5, 0.5),
"prod", "lab"
)
node_set(dst.firm, "cc2",
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"
)
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 = 20,
policy = list(
function(time, A, state) {
if (time > 1) {
node_set(A[[1]], "cc2",
type = "Leontief", a = state$last.A[, 1]
)
}
},
policyMarketClearingPrice
),
ts = TRUE
)
print(ge$p)
print(ge$z)
par(mfrow = c(1, 2))
matplot(ge$ts.p, type = "l")
matplot(ge$ts.z, type = "l")
}
f()
f(stickiness.firm = 0.8)
# }
Run the code above in your browser using DataLab