# NOT RUN {
#### a Leontief-type node
dst <- node_new("firm",
type = "Leontief", a = c(0.5, 0.1),
"wheat", "iron"
)
print(dst, "type")
node_print(dst)
plot(dst)
node_plot(dst)
demand_coefficient(dst, p = c(wheat = 1, iron = 2)) # the same as a = c(0.5, 0.1)
#### a CD-type node
dst <- node_new("firm",
type = "CD", alpha = 1, beta = c(0.5, 0.5),
"wheat", "iron"
)
demand_coefficient(dst, p = c(wheat = 1, iron = 2))
# the same as the following
CD_A(1, c(0.5, 0.5), c(1, 2))
#### a SCES-type node
dst <- node_new("firm",
type = "SCES",
alpha = 2, beta = c(0.8, 0.2), es = 0.5,
"wheat", "iron"
)
demand_coefficient(dst, p = c(wheat = 1, iron = 2))
# the same as the following
SCES_A(alpha = 2, Beta = c(0.8, 0.2), p = c(1, 2), es = 0.5)
CES_A(sigma = 1 - 1 / 0.5, alpha = 2, Beta = c(0.8, 0.2), p = c(1, 2), Theta = c(0.8, 0.2))
#### a func-type node
dst <- node_new("firm",
type = "FUNC",
func = function(p) {
CES_A(
sigma = -1, alpha = 2,
Beta = c(0.8, 0.2), p,
Theta = c(0.8, 0.2)
)
},
"wheat", "iron"
)
demand_coefficient(dst, p = c(wheat = 1, iron = 2))
# the same as the following
CES_A(sigma = -1, alpha = 2, Beta = c(0.8, 0.2), p = c(1, 2), Theta = c(0.8, 0.2))
####
p <- c(wheat = 1, iron = 3, labor = 2, capital = 4)
dst <- node_new("firm 1",
type = "SCES", sigma = -1, alpha = 1, beta = c(1, 1),
"cc1", "cc2"
)
node_set(dst, "cc1",
type = "Leontief", a = c(0.6, 0.4),
"wheat", "iron"
)
node_set(dst, "cc2",
type = "SCES", sigma = -1, alpha = 1, beta = c(1, 1),
"labor", "capital"
)
node_plot(dst)
demand_coefficient(dst, p)
####
p <- c(product = 1, labor = 1, money = 1)
dst <- node_new("firm",
type = "FIN", rate = c(0.75, 1 / 3),
"cc1", "money"
) # a financial-type node
node_set(dst, "cc1",
type = "Leontief", a = c(0.8, 0.2),
"product", "labor"
)
node_plot(dst)
demand_coefficient(dst, p)
#### the same as above
p <- c(product = 1, labor = 1, money = 1)
dst <- node_new("firm",
type = "Leontief", a = c(0.8, 0.2),
"cc1", "cc2"
)
node_set(dst, "cc1",
type = "FIN", rate = c(0.75, 1 / 3),
"product", "money"
)
node_set(dst, "cc2",
type = "FIN", rate = c(0.75, 1 / 3),
"labor", "money"
)
node_plot(dst)
demand_coefficient(dst, p)
#### the same as above
p <- c(product = 1, labor = 1, money = 1)
dst <- node_new("firm",
type = "FIN", rate = c(1, 1 / 3),
"cc1", "money"
) # Financial-type Demand Structure
node_set(dst, "cc1",
type = "Leontief", a = c(0.6, 0.15),
"product", "labor"
)
node_plot(dst)
demand_coefficient(dst, p)
# }
Run the code above in your browser using DataLab