コード例 #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(
                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()

        # demographics
        self.demographic_params = demographics.get_pop_objs(
            p.E, p.S, p.T, 1, 100, p.start_year
        )
        # demographics for 80 period lives (needed for getting e below)
        demog80 = demographics.get_pop_objs(20, 80, p.T, 1, 100, p.start_year)

        # earnings profiles
        self.e = income.get_e_interp(
            p.S,
            self.demographic_params["omega_SS"],
            demog80["omega_SS"],
            p.lambdas,
            plot=False,
        )
コード例 #2
0
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, :])
コード例 #3
0
ファイル: test_demographics.py プロジェクト: rkasher/OG-USA
def test_imm_smooth():
    """
    Test that population growth rates evolve smoothly.
    """
    E = 20
    S = 80
    T = int(round(4.0 * S))
    start_year = 2018

    (omega, g_n_ss, omega_SS, surv_rate, rho, g_n_vector, imm_rates,
     omega_S_preTP) = demographics.get_pop_objs(E, S, T, 1, 100, start_year,
                                                False)

    assert (np.any(np.absolute(imm_rates[:-1, :] - imm_rates[1:, :]) < 0.0001))
コード例 #4
0
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)
コード例 #5
0
ファイル: test_demographics.py プロジェクト: rkasher/OG-USA
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 = 2018

    (omega, g_n_ss, omega_SS, surv_rate, rho, g_n_vector, imm_rates,
     omega_S_preTP) = demographics.get_pop_objs(E, S, T, 1, 100, start_year,
                                                False)

    assert (np.allclose(omega_SS, omega[-1, :]))
コード例 #6
0
ファイル: test_demographics.py プロジェクト: rickecon/OG-USA
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 = 2018

    (omega, g_n_ss, omega_SS, surv_rate, rho, g_n_vector, imm_rates,
        omega_S_preTP) = demographics.get_pop_objs(E, S, T, 1, 100,
                                                   start_year, False)

    assert (np.allclose(omega_SS, omega[-1, :]))
コード例 #7
0
ファイル: test_demographics.py プロジェクト: rickecon/OG-USA
def test_imm_smooth():
    """
    Test that population growth rates evolve smoothly.
    """
    E = 20
    S = 80
    T = int(round(4.0 * S))
    start_year = 2018

    (omega, g_n_ss, omega_SS, surv_rate, rho, g_n_vector, imm_rates,
        omega_S_preTP) = demographics.get_pop_objs(E, S, T, 1, 100,
                                                   start_year, False)

    assert (np.any(np.absolute(imm_rates[:-1, :] - imm_rates[1:, :]) <
                   0.0001))
コード例 #8
0
ファイル: parameters.py プロジェクト: githubxinwen/OG-JPN
    def compute_default_params(self):
        """
        Does cheap calculations to return parameter values
        """
        # get parameters of elliptical utility function
        self.b_ellipse, self.upsilon = elliptical_u_est.estimation(
            self.frisch,
            self.ltilde
        )
        # determine length of budget window from start year and last
        # year in TC
        self.BW = int(TC_LAST_YEAR - self.start_year + 1)
        # Find number of economically active periods of life
        self.E = int(self.starting_age * (self.S / (self.ending_age -
                                                    self.starting_age)))
        # Find rates in model periods from annualized rates
        self.beta = (self.beta_annual ** ((self.ending_age -
                                          self.starting_age) / self.S))
        self.delta = (1 - ((1 - self.delta_annual) **
                           ((self.ending_age - self.starting_age) / self.S)))
        self.g_y = ((1 + self.g_y_annual) ** ((self.ending_age -
                                               self.starting_age) /
                                              self.S) - 1)

        # Extend parameters that may vary over the time path
        tp_param_list = ['alpha_G', 'alpha_T', 'Z', 'world_int_rate',
                         'delta_tau_annual', 'tau_b', 'tau_bq',
                         'tau_payroll', 'h_wealth', 'm_wealth',
                         'p_wealth', 'retirement_age',
                         'replacement_rate_adjust', 'zeta_D', 'zeta_K']
        for item in tp_param_list:
            this_attr = getattr(self, item)
            if this_attr.ndim > 1:
                this_attr = np.squeeze(this_attr, axis=1)
            # the next if statement is a quick fix to avoid having to
            # update all these time varying parameters if change T or S
            # ideally, the default json values are read in again and the
            # extension done is here done again with those defaults and
            # the new T and S values...
            if this_attr.size > self.T + self.S:
                this_attr = this_attr[:self.T + self.S]
            this_attr = np.concatenate((
                this_attr, np.ones((self.T + self.S - this_attr.size)) *
                this_attr[-1]))
            setattr(self, item, this_attr)
        # Try to deal with size of tau_c, but don't worry too much at
        # this point, will change when we determine how calibrate and if
        # add multiple consumption goods.
        tau_c_to_set = getattr(self, 'tau_c')
        if tau_c_to_set.size == 1:
            setattr(self, 'tau_c', np.ones((self.T + self.S, self.S,
                                            self.J)) * tau_c_to_set)
        elif tau_c_to_set.ndim == 3:
            if tau_c_to_set.shape[0] > self.T + self.S:
                tau_c_to_set = tau_c_to_set[:self.T + self.S, :, :]
            if tau_c_to_set.shape[1] > self.S:
                tau_c_to_set = tau_c_to_set[:, :self.S, :]
            if tau_c_to_set.shape[2] > self.J:
                tau_c_to_set = tau_c_to_set[:, :, :self.J]
            setattr(self, 'tau_c',  tau_c_to_set)
        else:
            print('please give a tau_c that is a single element or 3-D array')
            quit()

        # open economy parameters
        firm_r_annual = self.world_int_rate
        hh_r_annual = firm_r_annual
        self.firm_r = ((1 + firm_r_annual) **
                       ((self.ending_age - self.starting_age) /
                        self.S) - 1)
        self.hh_r = ((1 + hh_r_annual) **
                     ((self.ending_age - self.starting_age) /
                      self.S) - 1)

        # set period of retirement
        self.retire = (np.round(((self.retirement_age -
                                  self.starting_age) * self.S) /
                                80.0) - 1).astype(int)

        self.delta_tau = (1 - ((1 - self.delta_tau_annual) **
                               ((self.ending_age - self.starting_age) /
                                self.S)))

        # get population objects
        (self.omega, self.g_n_ss, self.omega_SS, self.surv_rate,
         self.rho, self.g_n, self.imm_rates,
         self.omega_S_preTP) = demographics.get_pop_objs(
                self.E, self.S, self.T, 1, 100, self.start_year,
                self.flag_graphs)
        # for constant demographics
        if self.constant_demographics:
            self.g_n_ss = 0.0
            self.g_n = np.zeros(self.T + self.S)
            surv_rate1 = np.ones((self.S, ))  # prob start at age S
            surv_rate1[1:] = np.cumprod(self.surv_rate[:-1], dtype=float)
            # number of each age alive at any time
            omega_SS = np.ones(self.S) * surv_rate1
            self.omega_SS = omega_SS / omega_SS.sum()
            self.imm_rates = np.zeros((self.T + self.S, self.S))
            self.omega = np.tile(np.reshape(self.omega_SS, (1, self.S)),
                                 (self.T + self.S, 1))
            self.omega_S_preTP = self.omega_SS

        # Interpolate chi_n and create omega_SS_80 if necessary
        if self.S == 80:
            self.omega_SS_80 = self.omega_SS
            self.chi_n = self.chi_n_80
        elif self.S < 80:
            self.age_midp_80 = np.linspace(20.5, 99.5, 80)
            self.chi_n_interp = si.interp1d(self.age_midp_80,
                                            np.squeeze(self.chi_n_80),
                                            kind='cubic')
            self.newstep = 80.0 / self.S
            self.age_midp_S = np.linspace(20 + 0.5 * self.newstep,
                                          100 - 0.5 * self.newstep,
                                          self.S)
            self.chi_n = self.chi_n_interp(self.age_midp_S)
            (_, _, self.omega_SS_80, _, _, _, _, _) = \
                demographics.get_pop_objs(20, 80, 320, 1, 100,
                                          self.start_year, False)
        self.e = income.get_e_interp(
            self.S, self.omega_SS, self.omega_SS_80, self.lambdas,
            plot=False)
コード例 #9
0
    def compute_default_params(self):
        '''
        Does cheap calculations to return parameter values

        Args:
            None

        Returns:
            None

        '''
        # get parameters of elliptical utility function
        self.b_ellipse, self.upsilon = elliptical_u_est.estimation(
            self.frisch, self.ltilde)
        # determine length of budget window from start year and last
        # year in TC
        self.BW = int(TC_LAST_YEAR - self.start_year + 1)
        # Find number of economically active periods of life
        self.E = int(self.starting_age *
                     (self.S / (self.ending_age - self.starting_age)))
        # Find rates in model periods from annualized rates
        self.beta = (
            1 / (rate_conversion(1 / self.beta_annual - 1, self.starting_age,
                                 self.ending_age, self.S) + 1))
        self.delta = (
            -1 * rate_conversion(-1 * self.delta_annual, self.starting_age,
                                 self.ending_age, self.S))
        self.g_y = rate_conversion(self.g_y_annual, self.starting_age,
                                   self.ending_age, self.S)

        # set fraction of income taxes from payroll to zero initially
        # will be updated when function tax function parameters
        self.frac_tax_payroll = np.zeros(self.T + self.S)

        # Extend parameters that may vary over the time path
        tp_param_list = [
            'alpha_G', 'alpha_T', 'Z', 'world_int_rate_annual',
            'delta_tau_annual', 'cit_rate', 'tau_bq', 'tau_payroll',
            'h_wealth', 'm_wealth', 'p_wealth', 'retirement_age',
            'replacement_rate_adjust', 'zeta_D', 'zeta_K'
        ]
        for item in tp_param_list:
            this_attr = getattr(self, item)
            if this_attr.ndim > 1:
                this_attr = np.squeeze(this_attr, axis=1)
            # the next if statement is a quick fix to avoid having to
            # update all these time varying parameters if change T or S
            # ideally, the default json values are read in again and the
            # extension done is here done again with those defaults and
            # the new T and S values...
            if this_attr.size > self.T + self.S:
                this_attr = this_attr[:self.T + self.S]
            this_attr = np.concatenate(
                (this_attr, np.ones(
                    (self.T + self.S - this_attr.size)) * this_attr[-1]))
            setattr(self, item, this_attr)
        # Try to deal with size of tau_c, but don't worry too much at
        # this point, will change when we determine how calibrate and if
        # add multiple consumption goods.
        tau_c_to_set = getattr(self, 'tau_c')
        if tau_c_to_set.size == 1:
            setattr(self, 'tau_c',
                    np.ones((self.T + self.S, self.S, self.J)) * tau_c_to_set)
        elif tau_c_to_set.ndim == 3:
            if tau_c_to_set.shape[0] > self.T + self.S:
                tau_c_to_set = tau_c_to_set[:self.T + self.S, :, :]
            if tau_c_to_set.shape[1] > self.S:
                tau_c_to_set = tau_c_to_set[:, :self.S, :]
            if tau_c_to_set.shape[2] > self.J:
                tau_c_to_set = tau_c_to_set[:, :, :self.J]
            setattr(self, 'tau_c', tau_c_to_set)
        else:
            print('please give a tau_c that is a single element or 3-D array')
            assert False

        # Try to deal with size of eta.  It may vary by S, J, T, but
        # want to allow user to enter one that varies by only S, S and J,
        # S and T, or T and S and J.
        eta_to_set = getattr(self, 'eta')
        # this is the case that vary only by S
        if eta_to_set.ndim == 1:
            assert eta_to_set.shape[0] == self.S
            eta_to_set = np.tile(
                (np.tile(eta_to_set.reshape(self.S, 1),
                         (1, self.J)) / self.J).reshape(1, self.S, self.J),
                (self.T + self.S, 1, 1))
        # this could be where vary by S and J or T and S
        elif eta_to_set.ndim == 2:
            # case if S by J input
            if eta_to_set.shape[0] == self.S:
                eta_to_set = np.tile(eta_to_set.reshape(1, self.S, self.J),
                                     (self.T + self.S, 1, 1))
                eta_to_set = eta_to_set = np.concatenate(
                    (eta_to_set,
                     np.tile(eta_to_set[-1, :, :].reshape(1, self.S, self.J),
                             (self.S, 1, 1))),
                    axis=0)
            # case if T by S input
            elif eta_to_set.shape[0] == self.T:
                eta_to_set = (np.tile(eta_to_set.reshape(self.T, self.S, 1),
                                      (1, 1, self.J)) / self.J)
                eta_to_set = eta_to_set = np.concatenate(
                    (eta_to_set,
                     np.tile(eta_to_set[-1, :, :].reshape(1, self.S, self.J),
                             (self.S, 1, 1))),
                    axis=0)
            else:
                print('please give an eta that is either SxJ or TxS')
                assert False
        # this is the case where vary by S, J, T
        elif eta_to_set.ndim == 3:
            eta_to_set = eta_to_set = np.concatenate(
                (eta_to_set,
                 np.tile(eta_to_set[-1, :, :].reshape(1, self.S, self.J),
                         (self.S, 1, 1))),
                axis=0)
        setattr(self, 'eta', eta_to_set)

        # reshape lambdas
        self.lambdas = self.lambdas.reshape(self.lambdas.shape[0], 1)
        # cast integers as integers
        self.S = int(self.S)
        self.T = int(self.T)
        self.J = int(self.J)

        # make sure zeta matrix sums to one (e.g., default off due to rounding)
        self.zeta = self.zeta / self.zeta.sum()

        # open economy parameters
        self.world_int_rate = rate_conversion(self.world_int_rate_annual,
                                              self.starting_age,
                                              self.ending_age, self.S)

        # set period of retirement
        self.retire = (np.round(
            ((self.retirement_age - self.starting_age) * self.S) / 80.0) -
                       1).astype(int)

        # Calculations for business income taxes
        # at some point, we will want to make Cost of Capital Calculator
        # a dependency to compute tau_b
        c_corp_share_of_assets = 0.55
        # this adjustment factor has as the numerator CIT receipts/GDP
        # from US data and as the demoninator CIT receipts/GDP from the
        # model with baseline parameterization and no adjustment to the
        # CIT_rate
        adjustment_factor_for_cit_receipts = 0.017 / 0.055
        self.tau_b = (self.cit_rate * c_corp_share_of_assets *
                      adjustment_factor_for_cit_receipts)
        self.delta_tau = (
            -1 * rate_conversion(-1 * self.delta_tau_annual, self.starting_age,
                                 self.ending_age, self.S))

        # get population objects
        (self.omega, self.g_n_ss, self.omega_SS, self.surv_rate, self.rho,
         self.g_n, self.imm_rates,
         self.omega_S_preTP) = demographics.get_pop_objs(
             self.E, self.S, self.T, 1, 100, self.start_year)
        # for constant demographics
        if self.constant_demographics:
            self.g_n_ss = 0.0
            self.g_n = np.zeros(self.T + self.S)
            surv_rate1 = np.ones((self.S, ))  # prob start at age S
            surv_rate1[1:] = np.cumprod(self.surv_rate[:-1], dtype=float)
            # number of each age alive at any time
            omega_SS = np.ones(self.S) * surv_rate1
            self.omega_SS = omega_SS / omega_SS.sum()
            self.imm_rates = np.zeros((self.T + self.S, self.S))
            self.omega = np.tile(np.reshape(self.omega_SS, (1, self.S)),
                                 (self.T + self.S, 1))
            self.omega_S_preTP = self.omega_SS

        # Interpolate chi_n and create omega_SS_80 if necessary
        if self.S == 80:
            self.omega_SS_80 = self.omega_SS
            self.chi_n = self.chi_n_80
        elif self.S < 80:
            self.age_midp_80 = np.linspace(20.5, 99.5, 80)
            self.chi_n_interp = si.interp1d(self.age_midp_80,
                                            np.squeeze(self.chi_n_80),
                                            kind='cubic')
            self.newstep = 80.0 / self.S
            self.age_midp_S = np.linspace(20 + 0.5 * self.newstep,
                                          100 - 0.5 * self.newstep, self.S)
            self.chi_n = self.chi_n_interp(self.age_midp_S)
            (_, _, self.omega_SS_80, _, _, _, _, _) = \
                demographics.get_pop_objs(20, 80, 320, 1, 100,
                                          self.start_year, False)
        self.e = income.get_e_interp(self.S,
                                     self.omega_SS,
                                     self.omega_SS_80,
                                     self.lambdas,
                                     plot=False)
コード例 #10
0
ファイル: parameters.py プロジェクト: rickecon/OG-USA
    def compute_default_params(self):
        """
        Does cheap calculations to return parameter values
        """
        # get parameters of elliptical utility function
        self.b_ellipse, self.upsilon = elliptical_u_est.estimation(
            self.frisch,
            self.ltilde
        )
        # determine length of budget window from start year and last
        # year in TC
        self.BW = int(TC_LAST_YEAR - self.start_year + 1)
        # Find number of economically active periods of life
        self.E = int(self.starting_age * (self.S / (self.ending_age -
                                                    self.starting_age)))
        # Find rates in model periods from annualized rates
        self.beta = (self.beta_annual ** ((self.ending_age -
                                          self.starting_age) / self.S))
        self.delta = (1 - ((1 - self.delta_annual) **
                           ((self.ending_age - self.starting_age) / self.S)))
        self.g_y = ((1 + self.g_y_annual) ** ((self.ending_age -
                                               self.starting_age) /
                                              self.S) - 1)

        # Extend parameters that may vary over the time path
        tp_param_list = ['alpha_G', 'alpha_T', 'Z', 'world_int_rate',
                         'delta_tau_annual', 'tau_b', 'tau_bq',
                         'tau_payroll', 'h_wealth', 'm_wealth',
                         'p_wealth', 'retirement_age',
                         'replacement_rate_adjust']
        for item in tp_param_list:
            this_attr = getattr(self, item)
            if this_attr.ndim > 1:
                this_attr = np.squeeze(this_attr, axis=1)
            # the next if statement is a quick fix to avoid having to
            # update all these time varying parameters if change T or S
            # ideally, the default json values are read in again and the
            # extension done is here done again with those defaults and
            # the new T and S values...
            if this_attr.size > self.T + self.S:
                this_attr = this_attr[:self.T + self.S]
            this_attr = np.concatenate((
                this_attr, np.ones((self.T + self.S - this_attr.size)) *
                this_attr[-1]))
            setattr(self, item, this_attr)
        # Try to deal with size of tau_c, but don't worry too much at
        # this point, will change when we determine how calibrate and if
        # add multiple consumption goods.
        tau_c_to_set = getattr(self, 'tau_c')
        if tau_c_to_set.size == 1:
            setattr(self, 'tau_c', np.ones((self.T + self.S, self.S,
                                            self.J)) * tau_c_to_set)
        elif tau_c_to_set.ndim == 3:
            if tau_c_to_set.shape[0] > self.T + self.S:
                tau_c_to_set = tau_c_to_set[:self.T + self.S, :, :]
            if tau_c_to_set.shape[1] > self.S:
                tau_c_to_set = tau_c_to_set[:, :self.S, :]
            if tau_c_to_set.shape[2] > self.J:
                tau_c_to_set = tau_c_to_set[:, :, :self.J]
            setattr(self, 'tau_c',  tau_c_to_set)
        else:
            print('please give a tau_c that is a single element or 3-D array')
            quit()

        # open economy parameters
        firm_r_annual = self.world_int_rate
        hh_r_annual = firm_r_annual
        self.firm_r = ((1 + firm_r_annual) **
                       ((self.ending_age - self.starting_age) /
                        self.S) - 1)
        self.hh_r = ((1 + hh_r_annual) **
                     ((self.ending_age - self.starting_age) /
                      self.S) - 1)

        # set period of retirement
        # self.retire = np.int(np.round(((self.retirement_age -
        #                                 self.starting_age) * self.S) /
        #                               80.0) - 1)
        self.retire = (np.round(((self.retirement_age -
                                  self.starting_age) * self.S) /
                                80.0) - 1).astype(int)

        self.delta_tau = (1 - ((1 - self.delta_tau_annual) **
                               ((self.ending_age - self.starting_age) /
                                self.S)))

        # get population objects
        (self.omega, self.g_n_ss, self.omega_SS, self.surv_rate,
         self.rho, self.g_n, self.imm_rates,
         self.omega_S_preTP) = demographics.get_pop_objs(
                self.E, self.S, self.T, 1, 100, self.start_year,
                self.flag_graphs)
        # for constant demographics
        if self.constant_demographics:
            self.g_n_ss = 0.0
            self.g_n = np.zeros(self.T + self.S)
            surv_rate1 = np.ones((self.S, ))  # prob start at age S
            surv_rate1[1:] = np.cumprod(self.surv_rate[:-1], dtype=float)
            # number of each age alive at any time
            omega_SS = np.ones(self.S) * surv_rate1
            self.omega_SS = omega_SS / omega_SS.sum()
            self.imm_rates = np.zeros((self.T + self.S, self.S))
            self.omega = np.tile(np.reshape(self.omega_SS, (1, self.S)),
                                 (self.T + self.S, 1))
            self.omega_S_preTP = self.omega_SS

        # Interpolate chi_n and create omega_SS_80 if necessary
        if self.S == 80:
            self.omega_SS_80 = self.omega_SS
            self.chi_n = self.chi_n_80
        elif self.S < 80:
            self.age_midp_80 = np.linspace(20.5, 99.5, 80)
            self.chi_n_interp = si.interp1d(self.age_midp_80,
                                            np.squeeze(self.chi_n_80),
                                            kind='cubic')
            self.newstep = 80.0 / self.S
            self.age_midp_S = np.linspace(20 + 0.5 * self.newstep,
                                          100 - 0.5 * self.newstep,
                                          self.S)
            self.chi_n = self.chi_n_interp(self.age_midp_S)
            (_, _, self.omega_SS_80, _, _, _, _, _) = \
                demographics.get_pop_objs(20, 80, 320, 1, 100,
                                          self.start_year, False)
        self.e = income.get_e_interp(
            self.S, self.omega_SS, self.omega_SS_80, self.lambdas,
            plot=False)
コード例 #11
0
        # self.retire = np.int(np.round(((self.retirement_age -
        #                                 self.starting_age) * self.S) /
        #                               80.0) - 1)
        self.retire = (np.round(((self.retirement_age -
                                  self.starting_age) * self.S) /
                                80.0) - 1).astype(int)

        self.delta_tau = (1 - ((1 - self.delta_tau_annual) **
                               ((self.ending_age - self.starting_age) /
                                self.S)))

        # get population objects
        (self.omega, self.g_n_ss, self.omega_SS, self.surv_rate,
         self.rho, self.g_n, self.imm_rates,
         self.omega_S_preTP) = demographics.get_pop_objs(
                self.E, self.S, self.T, 1, 100, self.start_year,
                self.flag_graphs)
        # for constant demographics
        if self.constant_demographics:
            self.g_n_ss = 0.0
            self.g_n = np.zeros(self.T + self.S)
            surv_rate1 = np.ones((self.S, ))  # prob start at age S
            surv_rate1[1:] = np.cumprod(self.surv_rate[:-1], dtype=float)
            # number of each age alive at any time
            omega_SS = np.ones(self.S) * surv_rate1
            self.omega_SS = omega_SS / omega_SS.sum()
            self.imm_rates = np.zeros((self.T + self.S, self.S))
            self.omega = np.tile(np.reshape(self.omega_SS, (1, self.S)),
                                 (self.T + self.S, 1))
            self.omega_S_preTP = self.omega_SS