Skip to content

Commit

Permalink
Rename mentions of estimagic -> optimagic.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmgaudecker committed Sep 9, 2024
1 parent af2abdb commit ef66d06
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 162 deletions.
7 changes: 4 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@

# Mock imports.
autodoc_mock_imports = [
"estimagic",
"optimagic",
"matplotlib",
"estimagic",
"jax",
"numpy",
"pandas",
Expand Down Expand Up @@ -116,7 +115,9 @@

html_logo = "_static/images/logo.svg"

html_theme_options = {"github_url": "https://github.com/OpenSourceEconomics/estimagic"}
html_theme_options = {
"github_url": "https://github.com/OpenSourceEconomics/skillmodels"
}

html_css_files = ["css/custom.css"]

Expand Down
13 changes: 6 additions & 7 deletions docs/source/getting_started/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"\n",
"import pandas as pd\n",
"import yaml\n",
"from estimagic import maximize\n",
"\n",
"from skillmodels.config import TEST_DIR\n",
"from skillmodels.likelihood_function import get_maximization_inputs"
Expand Down Expand Up @@ -59,11 +58,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Getting the inputs for ``estimagic.maximize``\n",
"## Getting the inputs for ``optimagic.maximize``\n",
"\n",
"Skillmodels basically just has one public function called ``get_maximization_inputs``. When called with a model specification and a dataset it contains a dictionary with everything you need to maximize the likelihood function using estimagic. \n",
"Skillmodels basically just has one public function called ``get_maximization_inputs``. When called with a model specification and a dataset it contains a dictionary with everything you need to maximize the likelihood function using optimagic. \n",
"\n",
"By everything you need I mean everything model specific. You should still use the optional arguments of ``maximize`` to tune the optimization."
"By everything you need I mean everything model-specific. You should still use the optional arguments of ``maximize`` to tune the optimization."
]
},
{
Expand Down Expand Up @@ -242,7 +241,7 @@
"2. The initial mean of the states is not estimated but assumed to be zero.\n",
"3. The anchoring parameters (intercepts, control variables, loadings and SDs of measurement error are pairwise equal across periods).\n",
"\n",
"Fortunately, estimagic makes it easy to express such constraints:"
"Fortunately, optimagic makes it easy to express such constraints:"
]
},
{
Expand Down Expand Up @@ -289,7 +288,7 @@
"metadata": {},
"outputs": [],
"source": [
"from estimagic.optimization.process_constraints import process_constraints\n",
"from om.process_constraints import process_constraints\n",
"\n",
"pc, pp = process_constraints(constraints, params)\n",
"params[\"group\"] = params.index.get_level_values(\"category\")\n",
Expand Down Expand Up @@ -331,7 +330,7 @@
"metadata": {},
"outputs": [],
"source": [
"res = maximize(\n",
"res = om.maximize(\n",
" criterion=loglike,\n",
" params=params,\n",
" algorithm=\"scipy_lbfgsb\",\n",
Expand Down
284 changes: 142 additions & 142 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,142 +1,142 @@
Welcome to the documentation of skillmodels!
============================================



Structure of the Documentation
==============================


.. raw:: html

<div class="container" id="index-container">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex">
<a href="getting_started/index.html" id="index-link">
<div class="card text-center intro-card shadow">
<img src="_static/images/light-bulb.svg" class="card-img-top"
alt="getting_started-icon" height="52"
>
<div class="card-body flex-fill">
<h5 class="card-title">Getting Started</h5>
<p class="card-text">
New users of estimagic should read this first
</p>
</div>
</div>
</a>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex">
<a href="how_to_guides/index.html" id="index-link">
<div class="card text-center intro-card shadow">
<img src="_static/images/book.svg" class="card-img-top"
alt="how-to guides icon" height="52"
>
<div class="card-body flex-fill">
<h5 class="card-title">How-to Guides</h5>
<p class="card-text">
Detailed instructions for specific and advanced tasks.
</p>
</div>
</div>
</a>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex">
<a href="explanations/index.html" id="index-link">
<div class="card text-center intro-card shadow">
<img src="_static/images/books.svg" class="card-img-top"
alt="explanations icon" height="52"
>
<div class="card-body flex-fill">
<h5 class="card-title">Explanations</h5>
<p class="card-text">
Background information to key topics
underlying the package.
</p>
</div>
</div>
</a>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex">
<a href="reference_guides/index.html" id="index-link">
<div class="card text-center intro-card shadow">
<img src="_static/images/coding.svg" class="card-img-top"
alt="reference guides icon" height="52"
>
<div class="card-body flex-fill">
<h5 class="card-title">Reference Guides</h5>
<p class="card-text">
Overview of functions and modules as well as
implementation details
</p>
</div>
</div>
</a>
</div>
</div>
</div>


Welcome to skillmodels, a Python implementation of estimators for skill
formation models. The econometrics of skill formation models is a very active
field and several estimators were proposed. None of them is implemented in
standard econometrics packages.


Skillmodels implements the Kalman filter based maximum likelihood estimator
proposed by Cunha, Heckman and Schennach (CHS), (`Econometrica 2010`_)


Skillmodels was developed for skill formation models but is by no means
limited to this particular application. It can be applied to any dynamic
nonlinear latent factor model.

The CHS estimator implemented here differs in two points from the one
implemented in their `replication files`_: 1) It uses different normalizations
that take into account the `critique`_ of Wiswall and Agostinelli. 2) It can
optionally use more robust square-root implementations of the Kalman filters.


Most of the code is unit tested. Furthermore, the results have been compared
to the Fortran code by CHS for two basic models with hypothetical data from
their `replication files`_.


**Citation**

It took countless hours to write skillmodels. I make it available under a very
permissive license in the hope that it helps other people to do great research
that advances our knowledge about the formation of cognitive and noncognitive
siklls. If you find skillmodels helpful, please don't forget to cite it. You
can find a suggested citation in the README file on `GitHub`_.


**Feedback**

If you find skillmodels helpful for research or teaching, please let me know.
If you encounter any problems with the installation or while using
skillmodels, please complain or open an issue at `GitHub`_.



.. _critique:
https://tinyurl.com/y3wl43kz

.. _replication files:
https://tinyurl.com/yyuq2sa4

.. _GitHub:
https://github.com/janosg/skillmodels


.. _Econometrica 2010:
http://onlinelibrary.wiley.com/doi/10.3982/ECTA6551/abstract


.. toctree::
:maxdepth: 1

getting_started/index
how_to_guides/index
explanations/index
reference_guides/index
Welcome to the documentation of skillmodels!
============================================



Structure of the Documentation
==============================


.. raw:: html

<div class="container" id="index-container">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex">
<a href="getting_started/index.html" id="index-link">
<div class="card text-center intro-card shadow">
<img src="_static/images/light-bulb.svg" class="card-img-top"
alt="getting_started-icon" height="52"
>
<div class="card-body flex-fill">
<h5 class="card-title">Getting Started</h5>
<p class="card-text">
New users of skillmodels should read this first
</p>
</div>
</div>
</a>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex">
<a href="how_to_guides/index.html" id="index-link">
<div class="card text-center intro-card shadow">
<img src="_static/images/book.svg" class="card-img-top"
alt="how-to guides icon" height="52"
>
<div class="card-body flex-fill">
<h5 class="card-title">How-to Guides</h5>
<p class="card-text">
Detailed instructions for specific and advanced tasks.
</p>
</div>
</div>
</a>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex">
<a href="explanations/index.html" id="index-link">
<div class="card text-center intro-card shadow">
<img src="_static/images/books.svg" class="card-img-top"
alt="explanations icon" height="52"
>
<div class="card-body flex-fill">
<h5 class="card-title">Explanations</h5>
<p class="card-text">
Background information to key topics
underlying the package.
</p>
</div>
</div>
</a>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 d-flex">
<a href="reference_guides/index.html" id="index-link">
<div class="card text-center intro-card shadow">
<img src="_static/images/coding.svg" class="card-img-top"
alt="reference guides icon" height="52"
>
<div class="card-body flex-fill">
<h5 class="card-title">Reference Guides</h5>
<p class="card-text">
Overview of functions and modules as well as
implementation details
</p>
</div>
</div>
</a>
</div>
</div>
</div>


Welcome to skillmodels, a Python implementation of estimators for skill
formation models. The econometrics of skill formation models is a very active
field and several estimators were proposed. None of them is implemented in
standard econometrics packages.


Skillmodels implements the Kalman filter based maximum likelihood estimator
proposed by Cunha, Heckman and Schennach (CHS), (`Econometrica 2010`_)


Skillmodels was developed for skill formation models but is by no means
limited to this particular application. It can be applied to any dynamic
nonlinear latent factor model.

The CHS estimator implemented here differs in two points from the one
implemented in their `replication files`_: 1) It uses different normalizations
that take into account the `critique`_ of Wiswall and Agostinelli. 2) It can
optionally use more robust square-root implementations of the Kalman filters.


Most of the code is unit tested. Furthermore, the results have been compared
to the Fortran code by CHS for two basic models with hypothetical data from
their `replication files`_.


**Citation**

It took countless hours to write skillmodels. I make it available under a very
permissive license in the hope that it helps other people to do great research
that advances our knowledge about the formation of cognitive and noncognitive
siklls. If you find skillmodels helpful, please don't forget to cite it. You
can find a suggested citation in the README file on `GitHub`_.


**Feedback**

If you find skillmodels helpful for research or teaching, please let me know.
If you encounter any problems with the installation or while using
skillmodels, please complain or open an issue at `GitHub`_.



.. _critique:
https://tinyurl.com/y3wl43kz

.. _replication files:
https://tinyurl.com/yyuq2sa4

.. _GitHub:
https://github.com/janosg/skillmodels


.. _Econometrica 2010:
http://onlinelibrary.wiley.com/doi/10.3982/ECTA6551/abstract


.. toctree::
:maxdepth: 1

getting_started/index
how_to_guides/index
explanations/index
reference_guides/index
13 changes: 7 additions & 6 deletions src/skillmodels/constraints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Construct an estimagic constraints list for a model."""
"""List of constraints for a model, which can be converted to optimagic constraints."""

import warnings

Expand All @@ -8,7 +8,9 @@


def get_constraints(dimensions, labels, anchoring_info, update_info, normalizations):
"""Generate the estimagic constraints implied by the model specification.
"""Generate constraints implied by the model specification.
The result can easily be converted to optimagic-style constraints.
Args:
model_dict (dict): The model specification. See: :ref:`model_specs`
Expand All @@ -23,7 +25,7 @@ def get_constraints(dimensions, labels, anchoring_info, update_info, normalizati
loadings and intercepts for each factor. See :ref:`normalizations`.
Returns:
list: List of estimagic compatible constraints.
list[dict]: List of constraints.
"""
constr = []
Expand Down Expand Up @@ -151,9 +153,8 @@ def _get_mixture_weights_constraints(n_mixtures):
"description": msg,
},
]
else:
msg = "Ensure that weights are between 0 and 1 and sum to 1."
return [{"loc": "mixture_weights", "type": "probability", "description": msg}]
msg = "Ensure that weights are between 0 and 1 and sum to 1."
return [{"loc": "mixture_weights", "type": "probability", "description": msg}]


def _get_stage_constraints(stagemap, stages):
Expand Down
Loading

0 comments on commit ef66d06

Please sign in to comment.