Firm Functions#

firm.py modules

ogcore.firm#

ogcore.firm.get_K(r, w, L, p, method, m=-1)[source]#

Get K from r, w, L. For determining capital demand for open economy case.

\[K_{t} = \frac{K_{t}}{L_{t}} \times L_{t}\]
Parameters:
  • r (array_like) – the real interest rate

  • w (array_like) – the wage rate

  • L (array_like) – aggregate labor

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

  • m (int or None) – production industry index

Returns:

aggregate capital demand

Return type:

K (array_like)

ogcore.firm.get_KLratio(r, w, p, method, m=-1)[source]#

This function solves for the capital-labor ratio given the interest rate r wage w and parameters.

\[\frac{K}{L} = \left(\frac{\gamma}{1 - \gamma - \gamma_g}\right) \left(\frac{w_t}{\frac{r_t + \delta - \tau_t^{corp}\delta_t^{\tau}}{1 - \tau_t^{corp}}}\right)^\varepsilon\]
Parameters:
  • r (array_like) – the real interest rate

  • w (array_like) – the wage rate

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

  • m (int) – production industry index

Returns:

the capital-labor ratio

Return type:

KLratio (array_like)

ogcore.firm.get_L_from_Y(w, Y, p, method)[source]#

Find aggregate labor L from output Y and wages w

\[L_{t} = \frac{(1 - \gamma - \gamma_g) Z_{t}^{\varepsilon-1} Y_{t}}{w_{t}^{\varepsilon}}\]
Parameters:
  • w (array_like) – the wage rate

  • Y (array_like) – aggregate output

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

Returns:

firm labor demand

Return type:

L (array_like)

ogcore.firm.get_MPx(Y, x, share, p, method, m=-1)[source]#

Compute the marginal product of x (where x is K, L, or K_g)

\[MPx = Z_t^\frac{\varepsilon-1}{\varepsilon}\left[(share) \frac{\hat{Y}_t}{\hat{x}_t}\right]^\frac{1}{\varepsilon}\]
Parameters:
  • Y (array_like) – output

  • x (array_like) – input to production function

  • share (scalar) – share of output paid to factor x

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

  • m (int) – production industry index

Returns:

the marginal product of x

Return type:

MPx (array_like)

ogcore.firm.get_Y(K, K_g, L, p, method, m=-1)[source]#

Generates aggregate output (GDP) from aggregate capital stock, aggregate labor, and CES production function parameters.

\[\begin{split}\hat{Y}_t &= F(\hat{K}_t, \hat{K}_{g,t}, \hat{L}_t) \\ &\equiv Z_t\biggl[(\gamma)^\frac{1}{\varepsilon}(\hat{K}_t)^\frac{\varepsilon-1}{\varepsilon} + (\gamma_{g})^\frac{1}{\varepsilon}(\hat{K}_{g,t})^\frac{\varepsilon-1}{\varepsilon} + (1-\gamma-\gamma_{g})^\frac{1}{\varepsilon}(\hat{L}_t)^\frac{\varepsilon-1}{\varepsilon}\biggr]^\frac{\varepsilon}{\varepsilon-1} \quad\forall t\end{split}\]
Parameters:
  • K (array_like) – aggregate private capital

  • K_g (array_like) – aggregate government capital

  • L (array_like) – aggregate labor

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

  • m (int or None) – industry index

Returns:

aggregate output

Return type:

Y (array_like)

ogcore.firm.get_cost_of_capital(r, p, method, m=-1)[source]#

Compute the cost of capital.

\[\rho_{m,t} = \frac{r_{t} + \delta_{M,t} - \tau^{b}_{m,t} \delta^{\tau}_{m,t} - \tau^{inv}_{m,t}\delta_{M,t}}{1 - \tau^{b}_{m,t}}\]
Parameters:
  • r (array_like) – the real interest rate

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

  • m (int or None) – production industry index

Returns:

cost of capital

Return type:

cost_of_capital (array_like)

ogcore.firm.get_pm(w, Y_vec, L_vec, p, method)[source]#

Find prices for outputs from each industry.

\[p_{m,t}=\frac{w_{t}}{\left((1-\gamma_m-\gamma_{g,m}) \frac{\hat{Y}_{m,t}}{\hat{L}_{m,t}}\right)^{\varepsilon_m}}\]
Parameters:
  • w (array_like) – the wage rate

  • Y_vec (array_like) – output for each industry

  • L_vec (array_like) – labor demand for each industry

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

Returns:

output prices for each industry

Return type:

p_m (array_like)

ogcore.firm.get_r(Y, K, p_m, p, method, m=-1)[source]#

This function computes the interest rate as a function of Y, K, and parameters using the firm’s first order condition for capital demand.

\[r_{t} = (1 - \tau^{corp}_t)Z_t^\frac{\varepsilon-1}{\varepsilon} \left[\gamma\frac{Y_t}{K_t}\right]^\frac{1}{\varepsilon} - \delta + \tau^{corp}_t\delta^\tau_t + \tau^{inv}_{m,t}\]
Parameters:
  • Y (array_like) – aggregate output

  • K (array_like) – aggregate capital

  • p_m (array_like) – output prices

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

  • m (int) – index of the production industry

Returns:

the real interest rate

Return type:

r (array_like)

ogcore.firm.get_w(Y, L, p_m, p, method, m=-1)[source]#

This function computes the wage as a function of Y, L, and parameters using the firm’s first order condition for labor demand.

\[w_t = Z_t^\frac{\varepsilon-1}{\varepsilon}\left[(1-\gamma-\gamma_g) \frac{\hat{Y}_t}{\hat{L}_t}\right]^\frac{1}{\varepsilon}\]
Parameters:
  • Y (array_like) – aggregate output

  • L (array_like) – aggregate labor

  • p_m (array_like) – output prices

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

  • m (int) – index of the production industry

Returns:

the real wage rate

Return type:

w (array_like)

ogcore.firm.get_w_from_r(r, p, method, m=-1)[source]#

Solve for a wage rate from a given interest rate. N.B. this is only appropriate if the production function only uses capital and labor as inputs. As such, this is not used for determining the domestic wage rate due to the presense of public capital in the production function. It is used only to determine the wage rate that affects the open economy demand for capital.

\[w = (1-\gamma)^\frac{1}{\varepsilon}Z\left[(\gamma)^\frac{1} {\varepsilon}\left(\frac{(1-\gamma)^\frac{1}{\varepsilon}} {\left[\frac{r + \delta - \tau^{corp}\delta^\tau}{(1 - \tau^{corp}) \gamma^\frac{1}{\varepsilon}Z}\right]^{\varepsilon-1} - \gamma^\frac{1}{\varepsilon}}\right) + (1-\gamma)^\frac{1}{\varepsilon}\right]^\frac{1}{\varepsilon-1}\]
Parameters:
  • r (array_like) – the real interest rate

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

  • m (int or None) – production industry index

Returns:

the real wage rate

Return type:

w (array_like)

ogcore.firm.solve_L(Y, K, K_g, p, method, m=-1)[source]#

Solve for labor supply from the production function

\[\hat{L}_{m,t} = \left(\frac{\left(\frac{\hat{Y}_{m,t}} {Z_{m,t}}\right)^{\frac{\varepsilon_m-1}{\varepsilon_m}} - \gamma_{m}^{\frac{1}{\varepsilon_m}}\hat{K}_{m,t}^ {\frac{\varepsilon_m-1}{\varepsilon_m}} - \gamma_{g,m}^{\frac{1}{\varepsilon_m}}\hat{K}_{g,m,t}^ {\frac{\varepsilon_m-1}{\varepsilon_m}}} {(1-\gamma_m-\gamma_{g,m})^{\frac{1}{\varepsilon_m}}} \right)^{\frac{\varepsilon_m}{\varepsilon_m-1}}\]
Parameters:
  • Y (array_like) – output for each industry

  • K_vec (array_like) – capital demand for each industry

  • K_g (array_like) – public capital stock

  • p (OG-Core Specifications object) – model parameters

  • method (str) – adjusts calculation dimensions based on ‘SS’ or ‘TPI’

  • m (int or None) – index of industry to compute L for (None will compute L for all industries)

Returns:

labor demand each industry

Return type:

L (array_like)