simulated_data <- simulate_data(
"diseq_basic", 500, 3, # model type, observed entities, observed time points
-0.9, 8.9, c(0.3, -0.2), c(-0.03, -0.01), # demand coefficients
0.9, 6.2, c(0.03), c(-0.05, 0.02) # supply coefficients
)
# initialize the model
model <- new(
"diseq_basic", # model type
subject = id, time = date, quantity = Q, price = P,
demand = P + Xd1 + Xd2 + X1 + X2, supply = P + Xs1 + X1 + X2,
simulated_data, # data
correlated_shocks = FALSE # use independent shocks
)
show(model)
simulated_data <- simulate_data(
# model type, observed entities and time points
"diseq_deterministic_adjustment", 500, 3,
# demand coefficients
-0.9, 8.9, c(0.03, -0.02), c(-0.03, -0.01),
# supply coefficients
0.9, 4.2, c(0.03), c(0.05, 0.02),
# price adjustment coefficient
1.4
)
# initialize the model
model <- new(
"diseq_deterministic_adjustment", # model type
subject = id, time = date, quantity = Q, price = P,
demand = P + Xd1 + Xd2 + X1 + X2, supply = P + Xs1 + X1 + X2,
simulated_data, # data
correlated_shocks = TRUE # allow shocks to be correlated
)
show(model)
# \donttest{
simulated_data <- simulate_data(
"diseq_directional", 500, 3, # model type, observed entities, observed time points
-0.2, 4.3, c(0.03, 0.02), c(0.03, 0.01), # demand coefficients
0.0, 4.0, c(0.03), c(0.05, 0.02) # supply coefficients
)
# in the directional model prices cannot be included in both demand and supply
model <- new(
"diseq_directional", # model type
subject = id, time = date, quantity = Q, price = P,
demand = P + Xd1 + Xd2 + X1 + X2, supply = Xs1 + X1 + X2,
simulated_data, # data
correlated_shocks = TRUE # allow shocks to be correlated
)
show(model)
# }
simulated_data <- simulate_data(
# model type, observed entities and time points
"diseq_stochastic_adjustment", 500, 3,
# demand coefficients
-0.1, 9.8, c(0.3, -0.2), c(0.6, 0.1),
# supply coefficients
0.1, 7.1, c(0.9), c(-0.5, 0.2),
# price adjustment coefficient
1.4, 3.1, c(0.8)
)
# initialize the model
model <- new(
"diseq_stochastic_adjustment", # model type
subject = id, time = date, quantity = Q, price = P,
demand = P + Xd1 + Xd2 + X1 + X2, supply = P + Xs1 + X1 + X2,
price_dynamics = Xp1,
simulated_data, # data
correlated_shocks = TRUE # allow shocks to be correlated
)
show(model)
simulated_data <- simulate_data(
"equilibrium_model", 500, 3, # model type, observed entities and time points
-0.9, 14.9, c(0.3, -0.2), c(-0.03, -0.01), # demand coefficients
0.9, 3.2, c(0.3), c(0.5, 0.02) # supply coefficients
)
# initialize the model
model <- new(
"equilibrium_model", # model type
subject = id, time = date, quantity = Q, price = P,
demand = P + Xd1 + Xd2 + X1 + X2, supply = P + Xs1 + X1 + X2,
simulated_data, # data
correlated_shocks = TRUE # allow shocks to be correlated
)
show(model)
Run the code above in your browser using DataLab