R/market_model.R, R/equilibrium_model.R
maximize_log_likelihood.RdMaximizes the log-likelihood using the
GSL
implementation of the BFGS algorithm. This function is primarily intended for
advanced usage. The estimate functionality is a fast,
analysis-oriented alternative. If the
GSL is not
available, the function returns a trivial result list with status set equal to -1.
If the
C++17
execution policies
are available, the implementation of the optimization is parallelized.
maximize_log_likelihood(
object,
start,
step,
objective_tolerance,
gradient_tolerance,
max_it
)
# S4 method for equilibrium_model
maximize_log_likelihood(
object,
start,
step,
objective_tolerance,
gradient_tolerance,
max_it
)A model object.
Initializing vector.
Optimization step.
Objective optimization tolerance.
Gradient optimization tolerance.
Maximum allowed number of iterations.
A list with the optimization output.
estimate
# \donttest{
model <- simulate_model(
"equilibrium_model", list(
# observed entities, observed time points
nobs = 500, tobs = 3,
# demand coefficients
alpha_d = -0.9, beta_d0 = 14.9, beta_d = c(0.3, -0.2), eta_d = c(-0.03, -0.01),
# supply coefficients
alpha_s = 0.9, beta_s0 = 3.2, beta_s = c(0.03), eta_s = c(0.05, 0.02)
),
seed = 99
)
# maximize the model's log-likelihood
mll <- maximize_log_likelihood(
model,
start = NULL, step = 1e-5,
objective_tolerance = 1e-4, gradient_tolerance = 1e-3, max_it = 1e+3
)
mll
#> $step
#> [1] 1e-05
#>
#> $objective_tolerance
#> [1] 1e-04
#>
#> $gradient_tolerance
#> [1] 0.001
#>
#> $status
#> [1] -1
#>
#> $optimizer
#> [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#>
#> $gradient
#> [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#>
#> $log_likelihood
#> [1] NaN
#>
#> $iterations
#> [1] 0
#>
# }