Rewards#
- HARK.rewards.CRRAutility(c, rho)#
Evaluates constant relative risk aversion (CRRA) utility of consumption c given risk aversion parameter rho.
- HARK.rewards.CRRAutilityP(c, rho)#
Evaluates constant relative risk aversion (CRRA) marginal utility of consumption c given risk aversion parameter rho.
- HARK.rewards.CRRAutilityPP(c, rho)#
Evaluates constant relative risk aversion (CRRA) marginal marginal utility of consumption c given risk aversion parameter rho.
- HARK.rewards.CRRAutilityPPP(c, rho)#
Evaluates constant relative risk aversion (CRRA) marginal marginal marginal utility of consumption c given risk aversion parameter rho.
- HARK.rewards.CRRAutilityPPPP(c, rho)#
Evaluates constant relative risk aversion (CRRA) marginal marginal marginal marginal utility of consumption c given risk aversion parameter rho.
- HARK.rewards.CRRAutility_inv(u, rho)#
Evaluates the inverse of the CRRA utility function (with risk aversion para- meter rho) at a given utility level u.
- HARK.rewards.CRRAutilityP_inv(uP, rho)#
Evaluates the inverse of the CRRA marginal utility function (with risk aversion parameter rho) at a given marginal utility level uP.
- HARK.rewards.CRRAutility_invP(u, rho)#
Evaluates the derivative of the inverse of the CRRA utility function (with risk aversion parameter rho) at a given utility level u.
- HARK.rewards.CRRAutilityP_invP(uP, rho)#
Evaluates the derivative of the inverse of the CRRA marginal utility function (with risk aversion parameter rho) at a given marginal utility level uP.
- HARK.rewards.StoneGearyCRRAutility(c, rho, shifter, factor=1.0)#
Evaluates Stone-Geary version of a constant relative risk aversion (CRRA) utility of consumption c with given risk aversion parameter rho and Stone-Geary intercept parameter shifter
- Parameters:
- Returns:
(unnamed) (float) – Utility
Tests
—–
Test a value which should pass
>>> c, CRRA, stone_geary = 1.0, 2.0, 0.0
>>> StoneGearyCRRAutility(c=c, rho=CRRA, shifter=stone_geary)
-1.0
- HARK.rewards.StoneGearyCRRAutilityP(c, rho, shifter, factor=1.0)#
Marginal utility of Stone-Geary version of a constant relative risk aversion (CRRA) utility of consumption c with a given risk aversion parameter rho and Stone-Geary intercept parameter shifter
- HARK.rewards.StoneGearyCRRAutilityPP(c, rho, shifter, factor=1.0)#
Marginal marginal utility of Stone-Geary version of a CRRA utilty function with risk aversion parameter rho and Stone-Geary intercept parameter shifter
- HARK.rewards.StoneGearyCRRAutility_inv(u, rho, shifter, factor=1.0)#
- HARK.rewards.StoneGearyCRRAutilityP_inv(uP, rho, shifter, factor=1.0)#
- HARK.rewards.StoneGearyCRRAutility_invP(u, rho, shifter, factor=1.0)#
- HARK.rewards.StoneGearyCRRAutilityP_invP(uP, rho, shifter, factor=1.0)#
- HARK.rewards.CARAutility(c, alpha)#
Evaluates constant absolute risk aversion (CARA) utility of consumption c given risk aversion parameter alpha.
- HARK.rewards.CARAutilityP(c, alpha)#
Evaluates constant absolute risk aversion (CARA) marginal utility of consumption c given risk aversion parameter alpha.
- HARK.rewards.CARAutilityPP(c, alpha)#
Evaluates constant absolute risk aversion (CARA) marginal marginal utility of consumption c given risk aversion parameter alpha.
- HARK.rewards.CARAutilityPPP(c, alpha)#
Evaluates constant absolute risk aversion (CARA) marginal marginal marginal utility of consumption c given risk aversion parameter alpha.
- HARK.rewards.CARAutility_inv(u, alpha)#
Evaluates inverse of constant absolute risk aversion (CARA) utility function at utility level u given risk aversion parameter alpha.
- HARK.rewards.CARAutilityP_inv(u, alpha)#
Evaluates the inverse of constant absolute risk aversion (CARA) marginal utility function at marginal utility uP given risk aversion parameter alpha.
- HARK.rewards.CARAutility_invP(u, alpha)#
Evaluates the derivative of inverse of constant absolute risk aversion (CARA) utility function at utility level u given risk aversion parameter alpha.
- HARK.rewards.cobb_douglas(x, zeta, factor)#
Evaluates Cobb Douglas utility at quantities of goods consumed x given elasticity parameters zeta and efficiency parameter factor.
- Parameters:
x (np.ndarray) – Quantities of goods consumed. First axis must index goods.
zeta (np.ndarray) – Elasticity parameters for each good. Must be consistent with x.
factor (float) – Multiplicative efficiency parameter. (e.g. TFP in production function)
- Returns:
(unnamed) – Utility
- Return type:
np.ndarray
- HARK.rewards.cobb_douglas_p(x, zeta, factor, arg=0)#
Evaluates the marginal utility of consumption indexed by arg good at quantities of goods consumed x given elasticity parameters zeta and efficiency parameter factor.
- Parameters:
- Returns:
(unnamed) – Utility
- Return type:
np.ndarray
- HARK.rewards.cobb_douglas_pp(x, zeta, factor, args=(0, 1))#
Evaluates the marginal marginal utility of consumption indexed by args at quantities of goods consumed x given elasticity parameters zeta and efficiency parameter factor.
- Parameters:
x (np.ndarray) – Quantities of goods consumed. First axis must index goods.
zeta (np.ndarray) – Elasticity parameters for each good. Must be consistent with x.
factor (float) – Multiplicative efficiency parameter.
args (tuple(int)) – Indexes of goods to evaluate marginal utility. args[0] is the index of the first derivative taken, and args[1] is the index of the second derivative taken.
- Returns:
(unnamed) – Utility
- Return type:
np.ndarray
- HARK.rewards.cobb_douglas_pn(x, zeta, factor, args=())#
Evaluates the nth marginal utility of consumption indexed by args at quantities of goods consumed x given elasticity parameters zeta and efficiency parameter factor.
- Parameters:
x (np.ndarray) – Quantities of goods consumed. First axis must index goods.
zeta (np.ndarray) – Elasticity parameters for each good. Must be consistent with x.
factor (float) – Multiplicative efficiency parameter.
args (tuple(int)) – Indexes of goods to evaluate marginal utility. args[0] is the index of the first derivative taken, and args[1] is the index of the second derivative taken. This function works by recursively taking derivatives, so args can be of any length.
- Returns:
(unnamed) – Utility
- Return type:
np.ndarray
- HARK.rewards.const_elast_subs(x, zeta, subs, factor, power)#
Evaluates Constant Elasticity of Substitution utility at quantities of goods consumed x given parameters alpha, ‘subs’, ‘factor’, and ‘power’.
- Parameters:
x (np.ndarray) – Quantities of goods consumed. First axis must index goods.
zeta (Sequence[float]) – Share parameter for each good. Must be consistent with x.
subs (float) – Substitution parameter.
factor (float) – Factor productivity parameter. (e.g. TFP in production function)
power (float) – degree of homogeneity of the utility function
- Returns:
CES utility.
- Return type:
np.ndarray
- HARK.rewards.const_elast_subs_p(x, zeta, subs, factor, power, arg=0)#
Evaluates the marginal utility of consumption indexed by arg good at quantities of goods consumed x given parameters alpha, ‘subs’, ‘factor’, and ‘power’.
- Parameters:
x (np.ndarray) – Quantities of goods consumed. First axis must index goods.
zeta (Sequence[float]) – Share parameter for each good. Must be consistent with x.
subs (float) – Substitution parameter.
factor (float) – Factor productivity parameter. (e.g. TFP in production function)
power (float) – degree of homogeneity of the utility function
- Returns:
CES marginal utility.
- Return type:
np.ndarray
- class HARK.rewards.UtilityFunction(eval_func, der_func=None, inv_func=None)#
Bases:
MetricObject
- distance_criteria = ['eval_func']#
- derivative(*args, **kwargs)#
- inverse(*args, **kwargs)#
- der(*args, **kwargs)#
- inv(*args, **kwargs)#
- class HARK.rewards.UtilityFuncCRRA(CRRA)#
Bases:
UtilityFunction
A class for representing a CRRA utility function.
- Parameters:
CRRA (float) – The coefficient of constant relative risk aversion.
- distance_criteria = ['CRRA']#
- derivative(c, order=1)#
The derivative of the utility function at a given level of consumption c.
- Parameters:
- Returns:
Derivative of CRRA utility evaluated at given consumption level(s).
- Return type:
float or np.ndarray
- Raises:
ValueError – Derivative of order higher than 4 is not supported.
- inverse(u, order=(0, 0))#
The inverse of the utility function at a given level of utility u.
- Parameters:
u (float or np.ndarray) – Utility level(s).
order (tuple, optional) – Order of derivatives. For example, order == (1,1) represents the first derivative of utility, inverted, and then differentiated once. For a simple mnemonic, order refers to the number of P`s in the function `CRRAutility[#1]_inv[#2]. By default (0, 0), which is just the inverse of utility.
- Returns:
Inverse of CRRA utility evaluated at given utility level(s).
- Return type:
float or np.ndarray
- Raises:
ValueError – Higher order derivatives are not supported.
- derinv(u, order=(1, 0))#
Short alias for inverse with default order = (1,0). See self.inverse.
- class HARK.rewards.UtilityFuncStoneGeary(CRRA, factor=1.0, shifter=0.0)#
Bases:
UtilityFuncCRRA
- derivative(c, order=1)#
The derivative of the utility function at a given level of consumption c.
- Parameters:
- Returns:
Derivative of CRRA utility evaluated at given consumption level(s).
- Return type:
float or np.ndarray
- Raises:
ValueError – Derivative of order higher than 4 is not supported.
- inverse(u, order=(0, 0))#
The inverse of the utility function at a given level of utility u.
- Parameters:
u (float or np.ndarray) – Utility level(s).
order (tuple, optional) – Order of derivatives. For example, order == (1,1) represents the first derivative of utility, inverted, and then differentiated once. For a simple mnemonic, order refers to the number of P`s in the function `CRRAutility[#1]_inv[#2]. By default (0, 0), which is just the inverse of utility.
- Returns:
Inverse of CRRA utility evaluated at given utility level(s).
- Return type:
float or np.ndarray
- Raises:
ValueError – Higher order derivatives are not supported.
- class HARK.rewards.UtilityFuncCobbDouglas(EOS, factor=1.0)#
Bases:
UtilityFunction
A class for representing a Cobb-Douglas utility function.
TODO: Add inverse methods.
- Parameters:
- distance_criteria = ['EOS', 'factor']#
- derivative(x, args=())#
- class HARK.rewards.UtilityFuncCobbDouglasCRRA(EOS, factor, CRRA)#
Bases:
UtilityFuncCobbDouglas
A class for representing a Cobb-Douglas aggregated CRRA utility function.
TODO: Add derivative and inverse methods.
- Parameters:
- distance_criteria = ['EOS', 'factor', 'CRRA']#
- class HARK.rewards.UtilityFuncConstElastSubs(shares, subs, homogeneity=1.0, factor=1.0)#
Bases:
UtilityFunction
A class for representing a constant elasticity of substitution utility function.
TODO: Add derivative and inverse methods.
- Parameters:
- distance_criteria = ['shares', 'subs', 'factor', 'homogeneity']#
- derivative(x, arg=0)#