Reference 〉 Class
Utility
CES

CobbDouglas(goodslist[str]|dict{str:num})

Defines a Cobb Douglas utility function U=∏n(gnαn). The Cobb Douglas utility function is equivalent to a CES utility function where the elasticity of substitution is equal to 1. This class is a subclass of CES, itself a subclass of Utility.

Initialization Parameters

  • goods list[str]|dict{str:num}, required

    Either a list of goods, in which case all exponents will be set to 1/len(goods), or a dict where the keys are the goods and the values are the corresponding exponents (the αns in the formula above). The list may, but does not have to, correspond to the goods registered in Goods.add().

Methods

Click a method name for more detailed documentation.

  • calculate( quantities )

    Calculates the agent's utility on the basis of the quantities entered. Subclasses are required to implement this method and should call the parent function super().calculate() at the beginning. The agent.stocks dict can be passed directly to this function.

    Utility.calculate() only returns the values, and is thus useful for counterfactual calculations. To actually realize utility from consumption, use Utility.consume() instead.

  • consume( quantities )

    Sets self.utility to the value returned from self.calculate(). The agent.stocks dict can be passed directly to this function.

  • demand( income, prices )

    Calculates the total demand for the various goods given some income. See the derivation from the utility function here.

  • mrs( good1, q1, good2, … )

    Calculates the marginal rate of substitution between two goods. Subclasses are required to implement this method.

  • mu( quantities )

    Calculates the marginal utilities of the goods in question on the basis of the entered quantities. Many utility functions, including the CES function, are such that the quantities of all goods are necessary to calculate the marginal utility of any good. Subclasses are required to implement this method.

Object Properties

  • utility num

    The agent's current level of utility, updated whenever Utility.consume() is called.

    Initial value: 0

  • elast num

    Stores the elasticity of substitution.

  • coeffs dict{str:num}

    Stores the coefficients on the goods (β in the CES formula).

  • exponents dict{str:num}

    The exponents in the goods (α in the formula above). This property aliases the coeffs property inherited from the CES class, since the coefficients of a CES utility function become the exponents of a Cobb Douglas function when the elasticity of substitution is 1, and exists mainly for expositional convenience.

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.

History