| optim_model_space_params | R Documentation |
Given a dataset and a generator of starting values, initializes a model space by drawing a starting point for each model. Then for each model performs a numerical optimization and finds parameters which maximize the likelihood.
optim_model_space_params(
df,
timestamp_col,
entity_col,
dep_var_col,
init_value,
nested,
exact_value = FALSE,
cl = NULL,
control = list(trace = 0, maxit = 10000, fnscale = -1, REPORT = 100, scale = 0.05),
max_restarts = 5,
restart_tol = 0.001,
max_reoptimizations = 5,
max_init_attempts = 100
)
df |
Data frame with data for the analysis. |
timestamp_col |
The name of the column with time stamps. |
entity_col |
Column with entities (e.g. countries). |
dep_var_col |
Column with the dependent variable. |
init_value |
Function of one argument |
nested |
Logical. If |
exact_value |
Whether the exact value of the likelihood should be
computed ( |
cl |
An optional cluster object. If supplied, the function will use this
cluster for parallel processing. If |
control |
a list of control parameters for the optimization which are
passed to optim. Default is
|
max_restarts |
Maximum number of times the BFGS optimization is
restarted from its previous solution for a single model. A restart resets
the internal curvature approximation of BFGS, which often makes further
progress on ill-conditioned likelihood ridges where a single run stalls.
Default is |
restart_tol |
Log-likelihood improvement between restarts below which
the optimization is considered converged. Improvements of this size are
immaterial for posterior model probabilities. Default is |
max_reoptimizations |
Maximum number of times a model is re-optimized
from a fresh starting point drawn from |
max_init_attempts |
Maximum number of starting points drawn from
|
List (or matrix) of parameters describing analyzed models. The returned
matrix carries a "convergence" attribute: a matrix with one column
per model and rows converged (1 if the likelihood value stalled at a
solution standard errors can be computed from, 0 if the restart budget was
exhausted while still improving or every re-optimization ended in a
degenerate region),
optim_code (the optim convergence code of the final
run), n_restarts, max_abs_gradient and n_init_draws
(the number of starting points drawn from init_value before one at
which the likelihood is defined was found). A large final
gradient with converged = 1 indicates parameters on a degenerate
(nearly collinear) likelihood ridge rather than a failed optimization.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.