# \donttest{
# initialize the model using the houses dataset
model <- new(
"diseq_deterministic_adjustment", # model type
subject = ID, time = TREND, quantity = HS, price = RM,
demand = RM + TREND + W + CSHS + L1RM + L2RM + MONTH,
supply = RM + TREND + W + L1RM + MA6DSF + MA3DHF + MONTH,
fair_houses(), # data
correlated_shocks = FALSE # let shocks be independent
)
# estimate the model object (BFGS is used by default)
fit <- estimate(model)
# estimate the model by specifying the optimization details passed to the optimizer.
fit <- estimate(model, control = list(maxit = 1e+6))
# summarize results
summary(fit)
# }
# \donttest{
# simulate an equilibrium model
model <- simulate_model(
"equilibrium_model", list(
# observed entities, observed time points
nobs = 500, tobs = 3,
# demand coefficients
alpha_d = -1.9, beta_d0 = 24.9, beta_d = c(2.3, -1.2), eta_d = c(2.0, -1.5),
# supply coefficients
alpha_s = .9, beta_s0 = 8.2, beta_s = c(3.3), eta_s = c(1.5, -2.2)
),
seed = 99
)
# maximize the model's log-likelihood
fit <- estimate(
model,
optimizer = "gsl", control = list(
step = 1e-2, objective_tolerance = 1e-8,
gradient_tolerance = 1e-2, maxit = 1e+3
)
)
summary(fit)
# }
Run the code above in your browser using DataLab