Ejemplo n.º 1
0
    def __init__(self, p,
                 estimate_tax_functions=False, estimate_beta=False,
                 estimate_chi_n=False,
                 tax_func_path=None, iit_reform={}, guid='', data='cps',
                 client=None, num_workers=1):

        self.estimate_tax_functions = estimate_tax_functions
        self.estimate_beta = estimate_beta
        self.estimate_chi_n = estimate_chi_n
        if estimate_tax_functions:
            self.tax_function_params = self.get_tax_function_parameters(
                self, p, iit_reform, guid, data, client, num_workers,
                run_micro=True, tax_func_path=tax_func_path)
        if estimate_beta:
            self.beta_j = estimate_beta_j.beta_estimate(self)
        # if estimate_chi_n:
        #     chi_n = self.get_chi_n()

        # Macro estimation
        self.macro_params = macro_params.get_macro_params()

        # eta estimation
        self.eta = transfer_distribution.get_transfer_matrix()

        # zeta estimation
        self.zeta = bequest_transmission.get_bequest_matrix()

        # earnings profiles
        self.e = income.get_e_interp(
            p.S, p.omega_SS, p.omega_SS_80, p.lambdas,
            plot=False)

        # demographics
        self.demographic_params = demographics.get_pop_objs(
                p.E, p.S, p.T, 1, 100, p.start_year)
def test_get_pop_objs():
    """
    Test of the that omega_SS and the last period of omega_path_S are
    close to each other.
    """
    E = 20
    S = 80
    T = int(round(4.0 * S))
    start_year = 2019

    pop_dict = demographics.get_pop_objs(E, S, T, 1, 100, start_year, False)

    assert np.allclose(pop_dict["omega_SS"], pop_dict["omega"][-1, :])
def test_imm_smooth():
    """
    Test that population growth rates evolve smoothly.
    """
    E = 20
    S = 80
    T = int(round(4.0 * S))
    start_year = 2019

    pop_dict = demographics.get_pop_objs(E, S, T, 1, 100, start_year, False)

    assert np.any(
        np.absolute(
            pop_dict["imm_rates"][:-1, :] - pop_dict["imm_rates"][1:, :]
        )
        < 0.0001
    )