Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure likelihood.py for #310 and estimagic's comparison plot. #313

Merged
merged 12 commits into from Feb 13, 2020

Conversation

tobiasraabe
Copy link
Member

@tobiasraabe tobiasraabe commented Jan 10, 2020

Solution / Implementation

  • We need to change some parts of the likelihood calculation from NumPy arrays to DataFrames which makes the distribution of the estimation over the dense state space easier. It is similar to what happened in Simplify simulation and prepare for #310. #312.

  • The likelihood function has two indicators. return_scalar defines whether the mean log likehood or contributions will be returned. This is essential to switch between estimation and standard error calculation.

    return_comparison_plot_data allows to return a DataFrame in the tidy data format which can be used to visualize the evolution of likelihoods during the estimation! One can plot the distributions of choice and wage likelihoods for periods, individuals, choices, and types.

  • Type probabilities are added to the comparison plot in Separate core and dense state space. #310.

@tobiasraabe tobiasraabe added this to the 2.0.0 milestone Jan 22, 2020
respy/likelihood.py Outdated Show resolved Hide resolved
from respy.shared import downcast_to_smallest_dtype
from respy.shared import generate_column_dtype_dict_for_estimation
from respy.shared import rename_labels_to_internal
from respy.solve import solve_with_backward_induction
from respy.state_space import StateSpace


def get_crit_func(params, options, df, version="log_like"):
def get_crit_func(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new interface. I think just passing the params is the best option!

@codecov
Copy link

codecov bot commented Feb 13, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@32a187e). Click here to learn what that means.
The diff coverage is 83.12%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #313   +/-   ##
========================================
  Coverage          ?   81.3%           
========================================
  Files             ?      38           
  Lines             ?    2493           
  Branches          ?       0           
========================================
  Hits              ?    2027           
  Misses            ?     466           
  Partials          ?       0
Impacted Files Coverage Δ
respy/tests/test_randomness.py 100% <100%> (ø)
respy/tests/test_solve.py 95.55% <100%> (ø)
respy/tests/test_method_of_simulated_moments.py 100% <100%> (ø)
respy/tests/test_simulate.py 100% <100%> (ø)
respy/__init__.py 93.75% <100%> (ø)
respy/tests/test_replication_kw_97.py 26.92% <100%> (ø)
respy/tests/test_model.py 100% <100%> (ø)
respy/tests/test_replication_kw_94.py 20% <100%> (ø)
respy/tests/test_integration.py 100% <100%> (ø)
respy/pre_processing/model_checking.py 86.66% <63.63%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32a187e...9c9a33f. Read the comment docs.

@tobiasraabe tobiasraabe merged commit 820946f into master Feb 13, 2020
@tobiasraabe tobiasraabe deleted the better-likelihood branch February 13, 2020 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants