Household Functions#
household.py modules
ogcore.household#
Household functions.#
- ogcore.household.marg_ut_cons(c, sigma)[source]#
Compute the marginal utility of consumption.
\[MU_{c} = c^{-\sigma}\]- Parameters:
c (array_like) – household consumption
sigma (scalar) – coefficient of relative risk aversion
- Returns:
marginal utility of consumption
- Return type:
output (array_like)
- ogcore.household.marg_ut_labor(n, chi_n, p)[source]#
Compute the marginal disutility of labor.
\[MDU_{l} = \chi^n_{s}\biggl(\frac{b}{\tilde{l}}\biggr) \biggl(\frac{n_{j,s,t}}{\tilde{l}}\biggr)^{\upsilon-1} \Biggl[1-\biggl(\frac{n_{j,s,t}}{\tilde{l}}\biggr)^\upsilon \Biggr]^{\frac{1-\upsilon}{\upsilon}}\]- Parameters:
n (array_like) – household labor supply
chi_n (array_like) – utility weights on disutility of labor
p (OG-Core Specifications object) – model parameters
- Returns:
marginal disutility of labor supply
- Return type:
output (array_like)
- ogcore.household.get_bq(BQ, j, p, method)[source]#
Calculate bequests to each household.
\[\hat{bq}_{j,s,t} = \zeta_{j,s} \frac{\hat{BQ}_{t}}{\lambda_{j}\hat{\omega}_{s,t}} \quad\forall j,s,t\]- Parameters:
BQ (array_like) – aggregate bequests
j (int) – index of lifetime ability group
p (OG-Core Specifications object) – model parameters
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
- Returns:
bequests received by each household
- Return type:
bq (array_like)
- ogcore.household.get_tr(TR, j, p, method)[source]#
Calculate transfers to each household.
\[\hat{tr}_{j,s,t} = \zeta_{j,s} \frac{\hat{TR}_{t}}{\lambda_{j}\hat{\omega}_{s,t}} \quad\forall j,s,t\]- Parameters:
TR (array_like) – aggregate transfers
j (int) – index of lifetime ability group
p (OG-Core Specifications object) – model parameters
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
- Returns:
transfers received by household
- Return type:
tr (array_like)
- ogcore.household.get_rm(RM, j, p, method)[source]#
Calculate remittances to each household.
\[\hat{rm}_{j,s,t} = \eta_{RM,j,s,t} \frac{\hat{RM}_{t}}{\lambda_{j}\hat{\omega}_{s,t}} \quad\forall j,s,t\]- Parameters:
RM (array_like) – aggregate remittances
j (int) – index of lifetime ability group
p (OG-Core Specifications object) – model parameters
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
- Returns:
remittances received by household
- Return type:
rm (array_like)
- ogcore.household.get_cons(r_p, w, p_tilde, p_i, b, b_splus1, n, bq, rm, net_tax, e, tau_c, p, method='SS')[source]#
Calculate household composite consumption.
\[\begin{split}\hat{c}_{j,s,t} &= \biggl[(1 + r_{p,t})\hat{b}_{j,s,t} + \hat{w}_t e_{j,s}n_{j,s,t} + \hat{bq}_{j,s,t} + \hat{rm}_{j,s,t} + \hat{tr}_{j,s,t} + \hat{ubi}_{j,s,t} + \hat{pension}_{j,s,t} - \hat{tax}_{j,s,t} \\ &\qquad - \sum_{i=1}^I\left(1 + \tau^c_{i,t}\right) p_{i,t}\hat{c}_{min,i} - e^{g_y}\hat{b}_{j,s+1,t+1}\biggr] / p_t \\ &\qquad\qquad\forall j,t \quad\text{and}\quad E+1\leq s\leq E+S \quad\text{where}\quad \hat{b}_{j,E+1,t}=0\end{split}\]- Parameters:
r_p (array_like) – the real interest rate
w (array_like) – the real wage rate
p_tilde (array_like) – the ratio of real GDP to nominal GDP
p_i (Numpy array) – prices for consumption good i
b (Numpy array) – household savings
b_splus1 (Numpy array) – household savings one period ahead
n (Numpy array) – household labor supply
bq (Numpy array) – household bequests received
rm (Numpy array) – household remittances received
net_tax (Numpy array) – household net taxes paid
e (Numpy array) – effective labor units
tau_c (Numpy array) – consumption tax rates
p (OG-Core Specifications object) – model parameters
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
- Returns:
household consumption
- Return type:
cons (Numpy array)
- ogcore.household.get_ci(c_s, p_i, p_tilde, tau_c, alpha_c, c_min, method='SS')[source]#
Compute consumption of good i given amount of composite consumption and prices.
\[c_{i,j,s,t} = \frac{c_{s,j,t}}{\alpha_{i,j}p_{i,j}}\]- Parameters:
c_s (array_like) – composite consumption
p_i (array_like) – prices for consumption good i
p_tilde (array_like) – composite good price
tau_c (array_like) – consumption tax rate
alpha_c (array_like) – consumption share parameters
c_min (array_like) – minimum consumption levels for each good i
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
- Returns:
consumption of good i
- Return type:
c_si (array_like)
- ogcore.household.fdc_active(p)[source]#
Whether the funded defined contribution (FDC) pillar is on, that is, whether any cohort pays a positive contribution rate
fdc_tau.- Parameters:
p (OG-Core Specifications object) – model parameters
- Returns:
True if any element of
fdc_tauis positive- Return type:
bool
- ogcore.household.get_fdc(r_p, w, n, e, j, p, method, t=None)[source]#
Funded defined contribution accounts of the households whose labor supply is
n, or None when the FDC pillar is off.In the steady state,
ncovers a whole lifetime (length S, or S x J for all income groups). On the time path (‘TPI’ or ‘TPI_scalar’),ncovers the remaining lifetime of one cohort of income group j that is age S - len(n) in period t, andr_pandware the paths over those periods. A cohort alive before the time path begins starts from the FDC claims of its age inp.fdc_claims_preTP(set byTPI.get_initial_SS_values), credited with the period-0 FDC return r_fdc = r_p - r_fdc_wedge.- Parameters:
r_p (scalar or Numpy array) – return on the household investment portfolio; the accounts earn this less
r_fdc_wedgew (scalar or Numpy array) – real wage rate
n (Numpy array) – labor supply
e (Numpy array) – effective labor units, shaped like
nj (int) – index of lifetime income group, None if all groups (steady state only)
p (OG-Core Specifications object) – model parameters
method (str) – ‘SS’, ‘TPI’, or ‘TPI_scalar’
t (int) – on the time path, the model period of the first element of
n(None means period 0)
- Returns:
- the accounts by age for
the ages in
n(the field R is the cohort’s retirement age)
- Return type:
fdc (pensions.FDCLifetime or None)
- ogcore.household.fdc_net_flow(fdc)[source]#
Net payment of households into their funded defined contribution accounts, the contribution less the annuity benefit, \(C_{j,s,t} - P_{j,s,t}\). It enters the budget constraint alongside net taxes but is neither government revenue nor a government outlay.
- Parameters:
fdc (pensions.FDCLifetime or None) – the accounts, None when the pillar is off
- Returns:
- contribution less benefit, or 0.0
when the pillar is off
- Return type:
net (Numpy array or scalar)
- ogcore.household.fdc_labor_wedge(cons, p_tilde, fdc, rho, beta, p)[source]#
Terms the funded defined contribution (FDC) pillar adds to the first order condition for labor supply.
An extra unit of labor at working age s raises the contribution by \(\partial C_s / \partial n_s\), which lowers consumption at s, and raises the annuity at every age u from the retirement age R on by \(\partial C_s / \partial n_s \, m_s e^{-g_y(u - R)}\), where \(m_s\) is the benefit at R bought by a unit contributed at s. The second effect is valued with the household’s own discounting of future marginal utility:
\[-\frac{u'(c_s)}{\tilde{p}_s}\frac{\partial C_s}{\partial n_s} + \frac{\partial C_s}{\partial n_s}m_s\sum_{u=R}^{S-1} \beta^{u-s}\prod_{i=s}^{u-1}(1 - \rho_i)e^{(1-\sigma)g_y(u-s)} \frac{u'(c_u)}{\tilde{p}_u}e^{-g_y(u-R)}\]The factor \(e^{(1-\sigma)g_y}\) per period is the weight of detrended utility in the lifetime objective. (The savings Euler equation shows \(e^{-\sigma g_y}\) instead because next period’s savings enter this period’s budget multiplied by \(e^{g_y}\).)
The second (accrual) term is included only when
p.pension_FOC_linkageis true; otherwise households choose labor as if the annuity did not depend on their contributions. The first term is always included.Contributions of households that die before R go to bequests, which the household does not value here (its bequest motive is over private savings only).
The arrays may cover the whole life (ages 0 to S - 1) or, on the time path, the remaining ages S - L to S - 1 of a cohort alive when the path begins.
- Parameters:
cons (Numpy array) – consumption by age, length S or S x J
p_tilde (scalar or Numpy array) – composite good price
fdc (pensions.FDCLifetime) – the accounts, shaped like
consrho (Numpy array) – mortality rates, shaped like
consbeta (scalar or Numpy array) – discount factor (length J when
consis S x J)p (OG-Core Specifications object) – model parameters
- Returns:
- term to add to the labor FOC error at
each age, shaped like
cons
- Return type:
wedge (Numpy array)
- ogcore.household.FOC_savings(r, w, p_tilde, p_i, b, b_splus1, n, bq, rm, factor, tr, ubi, theta, rho, etr_params, mtry_params, t, j, p, method, ndc_rates=None, net_tax=None)[source]#
Computes Euler errors for the FOC for savings in the steady state. This function is usually looped through over J, so it does one lifetime income group at a time.
\[\frac{c_{j,s,t}^{-\sigma}}{\tilde{p}_{t}} = e^{-\sigma g_y} \biggl[\chi^b_j\rho_s(b_{j,s+1,t+1})^{-\sigma} + \beta_j\bigl(1 - \rho_s\bigr)\Bigl(\frac{1 + r_{t+1} \bigl[1 - \tau^{mtry}_{s+1,t+1}\bigr]}{\tilde{p}_{t+1}}\Bigr) (c_{j,s+1,t+1})^{-\sigma}\biggr]\]- Parameters:
r (array_like) – the real interest rate
w (array_like) – the real wage rate
p_tilde (array_like) – composite good price
p_i (Numpy array) – prices for consumption good i
b (Numpy array) – household savings
b_splus1 (Numpy array) – household savings one period ahead
b_splus2 (Numpy array) – household savings two periods ahead
n (Numpy array) – household labor supply
bq (Numpy array) – household bequests received
rm (Numpy array) – household remittances received
factor (scalar) – scaling factor converting model units to dollars
tr (Numpy array) – government transfers to household
ubi (Numpy array) – universal basic income payment
theta (Numpy array) – social security replacement rate for each lifetime income group
rho (Numpy array) – mortality rates
etr_params (list) – parameters of the effective tax rate functions
mtry_params (list) – parameters of the marginal tax rate on capital income functions
t (int) – model period
j (int) – index of ability type
p (OG-Core Specifications object) – model parameters
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
ndc_rates (NDCRates) – calendar paths of the NDC credited and discount rates (
pensions.ndc_rates_path); None for the steady-state ratesnet_tax (Numpy array or None) – household net taxes, if the caller has already computed them for these arguments (as
tax.net_taxeswould); None to compute them here
- Returns:
Euler error from FOC for savings
- Return type:
euler (Numpy array)
- ogcore.household.FOC_labor(r, w, p_tilde, p_i, b, b_splus1, n, bq, rm, factor, tr, ubi, theta, chi_n, etr_params, mtrx_params, t, j, p, method, ndc_rates=None, net_tax=None)[source]#
Computes errors for the FOC for labor supply in the steady state. This function is usually looped through over J, so it does one lifetime income group at a time.
\[w_t e_{j,s}\bigl(1 - \tau^{mtrx}_{s,t}\bigr) \frac{(c_{j,s,t})^{-\sigma}}{ \tilde{p}_{t}} = \chi^n_{s} \biggl(\frac{b}{\tilde{l}}\biggr)\biggl(\frac{n_{j,s,t}} {\tilde{l}}\biggr)^{\upsilon-1}\Biggl[1 - \biggl(\frac{n_{j,s,t}}{\tilde{l}}\biggr)^\upsilon\Biggr] ^{\frac{1-\upsilon}{\upsilon}}\]- Parameters:
r (array_like) – the real interest rate
w (array_like) – the real wage rate
p_tilde (array_like) – composite good price
p_i (Numpy array) – prices for consumption good i
b (Numpy array) – household savings
b_splus1 (Numpy array) – household savings one period ahead
n (Numpy array) – household labor supply
bq (Numpy array) – household bequests received
rm (Numpy array) – household bequests received
factor (scalar) – scaling factor converting model units to dollars
tr (Numpy array) – government transfers to household
ubi (Numpy array) – universal basic income payment
theta (Numpy array) – social security replacement rate for each lifetime income group
chi_n (Numpy array) – utility weight on the disutility of labor supply
e (Numpy array) – effective labor units
etr_params (list) – parameters of the effective tax rate functions
mtrx_params (list) – parameters of the marginal tax rate on labor income functions
t (int) – model period
j (int) – index of ability type
p (OG-Core Specifications object) – model parameters
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
ndc_rates (NDCRates) – calendar paths of the NDC credited and discount rates (
pensions.ndc_rates_path); None for the steady-state ratesnet_tax (Numpy array or None) – household net taxes, if the caller has already computed them for these arguments (as
tax.net_taxeswould); None to compute them here
- Returns:
error from FOC for labor supply
- Return type:
FOC_error (Numpy array)
- ogcore.household.get_y(r_p, w, b_s, n, p, method)[source]#
Compute household income before taxes.
\[y_{j,s,t} = r_{p,t}b_{j,s,t} + w_{t}e_{j,s}n_{j,s,t}\]- Parameters:
r_p (array_like) – real interest rate on the household portfolio
w (array_like) – real wage rate
b_s (Numpy array) – household savings coming into the period
n (Numpy array) – household labor supply
p (OG-Core Specifications object) – model parameters
method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’
- ogcore.household.constraint_checker_SS(bssmat, nssmat, cssmat, ltilde)[source]#
Checks constraints on consumption, savings, and labor supply in the steady state.
- Parameters:
bssmat (Numpy array) – steady state distribution of capital
nssmat (Numpy array) – steady state distribution of labor
cssmat (Numpy array) – steady state distribution of consumption
ltilde (scalar) – upper bound of household labor supply
- Returns:
None
- Raises:
Warnings – if constraints are violated, warnings printed
- ogcore.household.constraint_checker_TPI(b_dist, n_dist, c_dist, t, ltilde)[source]#
Checks constraints on consumption, savings, and labor supply along the transition path. Does this for each period t separately.
- Parameters:
b_dist (Numpy array) – distribution of capital at time t
n_dist (Numpy array) – distribution of labor at time t
c_dist (Numpy array) – distribution of consumption at time t
t (int) – time period
ltilde (scalar) – upper bound of household labor supply
- Returns:
None
- Raises:
Warnings – if constraints are violated, warnings printed