diff --git a/docs/projects/_numerical_integration.py b/docs/projects/_numerical_integration.py index b1bfadc26..5ef9a8742 100644 --- a/docs/projects/_numerical_integration.py +++ b/docs/projects/_numerical_integration.py @@ -70,7 +70,6 @@ def get_rmse_rate(df, comparison_rates, methods): - figure """ for measure in ["absolute", "relative"]: - fig, ax = plt.subplots(1, 1, figsize=(6.5, 4.5)) for m in methods: diff --git a/respy/exogenous_processes.py b/respy/exogenous_processes.py index f34b03c38..1a1a432de 100644 --- a/respy/exogenous_processes.py +++ b/respy/exogenous_processes.py @@ -39,7 +39,6 @@ def compute_transition_probabilities( # Compute the probabilities for every exogenous process. probabilities = [] for exog_proc in exogenous_processes: - # Create the dot product of covariates and parameters. x_betas = [ pandas_dot(states[params.index], params) diff --git a/respy/likelihood.py b/respy/likelihood.py index 8c8947abf..588274ccc 100644 --- a/respy/likelihood.py +++ b/respy/likelihood.py @@ -460,7 +460,6 @@ def _simulate_log_probability_of_individuals_observed_choice( smoothed_value_functions = np.empty(n_choices) for i in range(n_draws): - for j in range(n_choices): value_function, _ = aggregate_keane_wolpin_utility( wages[j], nonpec[j], continuation_values[j], draws[i, j], delta @@ -553,7 +552,6 @@ def _process_estimation_data(df, state_space, optim_paras, options): def _update_optim_paras_with_initial_experience_levels(optim_paras, df): """Adjust the initial experience levels in optim_paras from the data.""" for choice in optim_paras["choices_w_exp"]: - # Adjust initial experience levels for all choices with experiences. init_exp_data = np.sort( df.query("Period == 0")[f"Experience_{choice.title()}"].unique() diff --git a/respy/shared.py b/respy/shared.py index d49722083..9bcbc16bb 100644 --- a/respy/shared.py +++ b/respy/shared.py @@ -493,7 +493,6 @@ def calculate_expected_value_functions( expected_value_functions[0] = 0 for i in range(n_draws): - max_value_functions = 0 for j in range(n_choices): diff --git a/respy/solve.py b/respy/solve.py index 76550da14..5821d36c7 100644 --- a/respy/solve.py +++ b/respy/solve.py @@ -197,7 +197,6 @@ def _solve_with_backward_induction(state_space, optim_paras, options): ) else: - wages = state_space.get_attribute_from_period("wages", period) nonpecs = state_space.get_attribute_from_period("nonpecs", period) continuation_values = state_space.get_continuation_values(period) diff --git a/respy/tests/_former_code.py b/respy/tests/_former_code.py index 4437f93f3..83cb22e42 100644 --- a/respy/tests/_former_code.py +++ b/respy/tests/_former_code.py @@ -72,7 +72,6 @@ def _create_state_space_kw94(n_periods, n_types, edu_starts, edu_max): # Construct state space by periods for period in range(n_periods): - # Build periodic indexer. max_edu_starts = max(edu_starts) dim_edu = min(max_edu_starts + period, edu_max) + 1 @@ -82,10 +81,8 @@ def _create_state_space_kw94(n_periods, n_types, edu_starts, edu_max): # Loop over all unobserved types for type_ in range(n_types): - # Loop overall all initial levels of schooling for edu_start in edu_starts: - # For occupations and education it is necessary to loop over period # + 1 as zero has to be included if it is never this choice and period # + 1 if it is always the same choice. @@ -95,22 +92,17 @@ def _create_state_space_kw94(n_periods, n_types, edu_starts, edu_max): # Loop over all admissible work experiences for Occupation A for exp_a in range(period + 1): - # Loop over all admissible work experience for Occupation B for exp_b in range(period + 1 - exp_a): - # Loop over all admissible additional education levels for edu_add in range( min(period + 1 - exp_a - exp_b, edu_max + 1 - edu_start) ): - # Loop over all admissible values for the lagged activity: # (1) Occupation A, (2) Occupation B, (3) Education, and (4) # Home. for lagged_choice in range(4): - if period > 0: - # (0, 1) Whenever an agent has only worked in # Occupation A, then the lagged choice cannot be # anything other than one. @@ -231,7 +223,6 @@ def _create_state_space_kw97_base(n_periods, n_types, edu_starts, edu_max): # Construct state space by periods for period in range(n_periods): - # Build periodic indexer. max_edu_starts = max(edu_starts) dim_edu = min(max_edu_starts + period, edu_max) + 1 @@ -241,10 +232,8 @@ def _create_state_space_kw97_base(n_periods, n_types, edu_starts, edu_max): # Loop over all unobserved types for type_ in range(n_types): - # Loop overall all initial levels of schooling for edu_start in edu_starts: - # For occupations and education it is necessary to loop over period # + 1 as zero has to be included if it is never this choice and period # + 1 if it is always the same choice. @@ -254,13 +243,10 @@ def _create_state_space_kw97_base(n_periods, n_types, edu_starts, edu_max): # Loop over all admissible work experiences for Occupation A for exp_a in range(period + 1): - # Loop over all admissible work experience for Occupation B for exp_b in range(period + 1 - exp_a): - # Loop over all admissible work experience for Occupation B for exp_mil in range(period + 1 - exp_a - exp_b): - # Loop over all admissible additional education levels for edu_add in range( min( @@ -268,7 +254,6 @@ def _create_state_space_kw97_base(n_periods, n_types, edu_starts, edu_max): edu_max + 1 - edu_start, ) ): - # Continue if state still exist. This condition is # only triggered by multiple initial levels of # education. @@ -336,7 +321,6 @@ def _create_state_space_kw97_extended(n_periods, n_types, edu_starts, edu_max): # Construct state space by periods for period in range(n_periods): - # Build periodic indexer. max_edu_starts = max(edu_starts) dim_edu = min(max_edu_starts + period, edu_max) + 1 @@ -346,10 +330,8 @@ def _create_state_space_kw97_extended(n_periods, n_types, edu_starts, edu_max): # Loop over all unobserved types for type_ in range(n_types): - # Loop overall all initial levels of schooling for edu_start in edu_starts: - # For occupations and education it is necessary to loop over period # + 1 as zero has to be included if it is never this choice and period # + 1 if it is always the same choice. @@ -359,13 +341,10 @@ def _create_state_space_kw97_extended(n_periods, n_types, edu_starts, edu_max): # Loop over all admissible work experiences for Occupation A for exp_a in range(period + 1): - # Loop over all admissible work experience for Occupation B for exp_b in range(period + 1 - exp_a): - # Loop over all admissible work experience for Occupation B for exp_mil in range(period + 1 - exp_a - exp_b): - # Loop over all admissible additional education levels for edu_add in range( min( @@ -373,14 +352,11 @@ def _create_state_space_kw97_extended(n_periods, n_types, edu_starts, edu_max): edu_max + 1 - edu_start, ) ): - # Loop over all admissible values for the lagged # activity: (1) Occupation A, (2) Occupation B, (3) # Military, (4) Education, and (5) Home. for lagged_choice in range(5): - if period > 0: - # (0, 1) Whenever an agent has only worked in # Occupation A, then the lagged choice cannot be # anything other than one. diff --git a/respy/tests/test_solve.py b/respy/tests/test_solve.py index eca5a062d..7bd67e6b9 100644 --- a/respy/tests/test_solve.py +++ b/respy/tests/test_solve.py @@ -226,7 +226,6 @@ def test_create_state_space_vs_specialized_kw97(model): ] for index in indexer.keys(): - if index[0] == period: assert list(index) in indices_old