diff --git a/docs/book/content/theory/equilibrium.md b/docs/book/content/theory/equilibrium.md index f09adf093..06310320a 100644 --- a/docs/book/content/theory/equilibrium.md +++ b/docs/book/content/theory/equilibrium.md @@ -58,15 +58,15 @@ The computational algorithm for solving for the steady-state follows the steps b 1. Use the techniques from Section {ref}`SecDemogPopSSTP` to solve for the steady-state population distribution vector $\boldsymbol{\bar{\omega}}$ and steady-state growth rate $\bar{g}_n$ of the exogenous population process. -2. Choose an initial guess for the values of the steady-state interest rate (the after-tax marginal product of capital) $\bar{r}^i$, wage rate $\bar{w}^i$, portfolio rate of return $\bar{r}_p^i$, output prices $\boldsymbol{\bar{p}}^i$ (note that $\bar{p}_M =1$ since it's the numeraire good), total bequests $\overline{BQ}^{\,i}$, total household transfers $\overline{TR}^{\,i}$, and income multiplier $factor^i$, where superscript $i$ is the index of the iteration number of the guess. +2. Choose an initial guess for the values of the steady-state interest rate (the after-tax rate of return on firm equity) $\bar{r}^i$, wage rate $\bar{w}^i$, portfolio rate of return $\bar{r}_p^i$, output prices $\boldsymbol{\bar{p}}^i$ (note that $\bar{p}_M =1$ since it's the numeraire good), total bequests $\overline{BQ}^{\,i}$, total household transfers $\overline{TR}^{\,i}$, and income multiplier $factor^i$, where superscript $i$ is the index of the iteration number of the guess. 1. Given $\boldsymbol{\bar{p}}^i$ find the price of consumption goods using {eq}`EqHH_pi2` - 2. From price of consumption goods, determine the price of the composite consmpution good, $\bar{p}$ using equation {eq}`EqCompPnorm2` + 2. Using the prices of consumption goods, determine the price of the composite consumption good, $\bar{p}$ using equation {eq}`EqCompPnorm2` 3. Using {eq}`Eq_tr` with $\overline{TR}^{\,i}$, find transfers to each household, $\overline{tr}_{j,s}^i$ 4. Using the bequest transfer process, {eq}`Eq_bq` and aggregate bequests, $\overline{BQ}^{\,i}$, find $bq_{j,s}^i$ 5. Given values $\bar{p}$, $\bar{r}_{p}^i$, $\bar{w}^i$ $\overline{bq}_{j,s}^i$, $\overline{tr}_{j,s}^i$, and $factor^i$, solve for the steady-state household labor supply $\bar{n}_{j,s}$ and savings $\bar{b}_{j,s+1}$ decisions for all $j$ and $E+1\leq s\leq E+S$. - 1. Each of the $j\in 1,2,...J$ sets of $2S$ steady-state Euler equations can be solved separately. `OG-Core` parallelizes this process using the maximum number of processors possible (up to $J$ processors). Solve each system of Euler equations using a multivariate root-finder to solve the $2S$ necessary conditions of the household given by the following steady-state versions of stationarized household Euler equations {eq}`EqStnrz_eul_n`, {eq}`EqStnrz_eul_b`, and {eq}`EqStnrz_eul_bS` simultaneously for each $j$. + 1. Each of the $j\in 1,2,...J$ sets of $2S$ steady-state Euler equations can be solved separately. `OG-Core` parallelizes this process using the maximum number of processors available (up to $J$ processors). Solve each system of Euler equations using a multivariate root-finder to solve the $2S$ necessary conditions of the household given by the following steady-state versions of stationarized household Euler equations {eq}`EqStnrz_eul_n`, {eq}`EqStnrz_eul_b`, and {eq}`EqStnrz_eul_bS` simultaneously for each $j$. ```{math} :label: EqSS_HHBC @@ -90,9 +90,10 @@ The computational algorithm for solving for the steady-state follows the steps b :label: EqSS_HHeul_bS (\bar{c}_{j,E+S})^{-\sigma} = e^{-\sigma g_y}\chi^b_j(\bar{b}_{j,E+S+1})^{-\sigma} \quad\forall j ``` - 6. Determine from the quantity of the composite consumption good consumed by each household, $\bar{c}_{j,s}$, use equation {eq}`EqHH_cmDem` to determine consumption of each output good, $\bar{c}_{m,j,s}$ - 7. Using $\bar{c}_{m,j,s}$ in {eq}`EqCmt`, solve for aggregate consumption of each output good, $\bar{C}_{m}$ - 8. Given values for $\bar{n}_{j,s}$ and $\bar{b}_{j,s+1}$ for all $j$ and $s$, solve for steady-state labor supply, $\bar{L}$, savings, $\bar{B}$ + 6. From the quantity of the composite consumption good consumed by each household, $\bar{c}_{j,s}$, use equation {eq}`EqHH_cmDem` to determine consumption of each output good, $\bar{c}_{i,j,s}$ + 7. Using $\bar{c}_{i,j,s}$ in {eq}`EqCmt`, solve for aggregate consumption of each consumption good, $\bar{C}_{i}$ + 8. Using $\bar{C}_{i}$ in {eq}`EqMarkConsDemand`, solve for aggregate consumption of each output good, $\bar{C}_{m}$ + 9. Given values for $\bar{n}_{j,s}$ and $\bar{b}_{j,s+1}$ for all $j$ and $s$, solve for steady-state labor supply, $\bar{L}$, savings, $\bar{B}$ 1. Use $\bar{n}_{j,s}$ and the steady-state version of the stationarized labor market clearing equation {eq}`EqStnrzMarkClrLab` to get a value for $\bar{L}^{i}$. ```{math} @@ -105,50 +106,75 @@ The computational algorithm for solving for the steady-state follows the steps b :label: EqSS_Bt \bar{B} \equiv \frac{1}{1 + \bar{g}_{n}}\sum_{s=E+2}^{E+S+1}\sum_{j=1}^{J}\Bigl(\bar{\omega}_{s-1}\lambda_j\bar{b}_{j,s} + i_s\bar{\omega}_{s}\lambda_j\bar{b}_{j,s}\Bigr) ``` - 9. Solve for the exogenous government interest rate $\bar{r}_{gov}^{i}$ using equation {eq}`EqUnbalGBC_rate_wedge`. - 10. Use {eq}`EqStnrzTfer` to find $\bar{Y}^i$ from the guess of $\overline{TR}^i$ - 11. Use {eq}`EqStnrz_DY` to find $\bar{D}^i$ from $\bar{Y}^i$ - 12. Using $\bar{D}^i$, we can find foreign investor holdings of debt, $\bar{D}^{f,i}$ from {eq}`EqMarkClr_zetaD2` and then solve for domestic debt holdings through the debt market clearing condition: $\bar{D}^{d,i} = \bar{D}^i - \bar{D}^{f,i}$ - 13. Using $\bar{Y}^i$, find government infrastructure investment, $\bar{I}_{g}$ from {eq}`EqStnrz_Igt` - 14. Using the law of motion of the stock of infrastructure, {eq}`EqStnrz_Kgmt`, and $\bar{I}_{g}$, solve for $\bar{K}_{g}^{i}$ - 15. Find output and factor demands for M-1 industries: + 10. Solve for the exogenous government interest rate $\bar{r}_{gov}^{i}$ using equation {eq}`EqUnbalGBC_rate_wedge`. + 11. Use {eq}`EqStnrzTfer` to find $\bar{Y}^i$ from the guess of $\overline{TR}^i$ + 12. Use {eq}`EqStnrz_DY` to find $\bar{D}^i$ from $\bar{Y}^i$ + 13. Using $\bar{D}^i$, we can find foreign investor holdings of debt, $\bar{D}^{f,i}$ from {eq}`EqMarkClr_zetaD2` and then solve for domestic debt holdings through the debt market clearing condition: $\bar{D}^{d,i} = \bar{D}^i - \bar{D}^{f,i}$ + 14. Using $\bar{Y}^i$, find government infrastructure investment, $\bar{I}_{g}$ from {eq}`EqStnrz_Igt` + 15. Using the law of motion of the stock of infrastructure, {eq}`EqStnrz_Kgmt`, and $\bar{I}_{g}$, solve for $\bar{K}_{g}^{i}$ + 16. Find output and factor demands for M-1 industries: 1. By {eq}`EqMarkClrGoods_Mm1`, $\hat{Y}_{m,t}=\hat{C}_{m,t}$, where $\hat{C}_{m,t}$ is determined by {eq}`EqStnrzEqCmt` - 2. The capital-output ratio can be determined from the FOC for the firms' choice of capital: $\frac{\bar{K}_m}{\bar{Y}_m} = \gamma_m\left[\frac{\bar{r} +\bar{\delta}_M - \bar{\tau}^{corp}_m\bar{\delta}^{\tau}_m - \bar{\tau}^{inv}_m\bar{\delta}_M}{\left(1 - \bar{\tau}^{corp}_m\right)\bar{p}_m(\bar{Z}_m)^\frac{\varepsilon_m-1}{\varepsilon_m}}\right]^{-\varepsilon_m}$ - 3. Capital demand can thus be found: $\bar{K}_{m} = \frac{\bar{K}_m}{\bar{Y}_m} * \bar{Y}_m$ - 4. Labor demand can be found by inverting the production function: + + 2. The labor-output ratio can be determined from the FOC for the firms' choice of labor: $\frac{\bar{Y}_m}{\bar{L}_m} = \left(\bar{Z}_m\right)^{\varepsilon_m - 1}\frac{(1-\gamma_m - \gamma_{g,m})}{(\bar{w}\bar{p}_m)}$ + 3. Labor demand can thus be found: $\bar{L}_{m} = \frac{\bar{L}_m}{\bar{Y}_m} * \bar{Y}_m$ + 4. Capital demand can be found by inverting the production function: ```{math} - :label: EqSS_solveL - \bar{L}_{m} = \left(\frac{\left(\frac{\bar{Y}_m}{\bar{Z}_m}\right)^{\frac{\varepsilon_m-1}{\varepsilon_m}} - \gamma_{m}^{\frac{1}{\varepsilon_m}}\bar{K}_m^{\frac{\varepsilon_m-1}{\varepsilon_m}} - \gamma_{g,m}^{\frac{1}{\varepsilon_m}}\bar{K}_{g,m}^{\frac{\varepsilon_m-1}{\varepsilon_m}}}{(1-\gamma_m-\gamma_{g,m})^{\frac{1}{\varepsilon_m}}}\right)^{\frac{\varepsilon_m}{\varepsilon_m-1}} + :label: EqSS_solveK + \bar{K}_{m} = \left(\frac{\left(\frac{\bar{Y}_m}{\bar{Z}_m}\right)^{\frac{\varepsilon_m-1}{\varepsilon_m}} - \gamma_{g,m}^{\frac{1}{\varepsilon_m}} \bar{K}_{g,m}^{\frac{\varepsilon_m-1}{\varepsilon_m}}- (1 - \gamma_{m} - \gamma_{g,m})^{\frac{1}{\varepsilon_m}}\bar{L}_m^{\frac{\varepsilon_m-1}{\varepsilon_m}}}{\gamma_m^{\frac{1}{\varepsilon_m}}}\right)^{\frac{\varepsilon_m}{\varepsilon_m-1}} ``` - 5. Use the steady-state world interest rate $\bar{r}^*$ and labor demand $\bar{L}_m$ to solve for private capital demand at the world interest rate $\bar{K}_m^{r^*}$ using the steady-state version of {eq}`EqFirmsMPKg_opt` + 5. The tax basis of the capital stock can be solved for using the steady-state version of the law of motion for the tax basis of the capital stock: - ```{math} - :label: EqSS_MPKg - \bar{K}_m^{r^*} = \bar{L}_m\left(\frac{\bar{w}}{\frac{\bar{r} + \bar{\delta}_M - \bar{\tau}^{corp}_m\bar{\delta}^{\tau}_m - \bar{\tau}^{inv}_m\bar{\delta}_M}{1 - \bar{\tau}^{corp}_m}}\right)^{\varepsilon_m} \frac{\gamma_m}{(1 - \gamma_m - \gamma_{g,m})} + ```{math} + :label: EqSS_MPK_tau + \bar{K}_m^{\tau} = \frac{(1-\tau^{inv})\delta_m \bar{K}_{m}}{\delta^{\tau}_m} ``` - - 16. Determine factor demands and output for industry $M$: - 1. $\bar{L}_M = \bar{L} - \sum_{m=1}^{M-1}\bar{L}_{m}$ - 2. Find $\bar{K}_m^{r^*}$ using the steady-state version of {eq}`EqFirmsMPKg_opt` - 3. Find total capital supply, and the split between that from domestic and foreign households: $\bar{K}^{i'}$, $\bar{K}^d$, $\bar{K}^f$: - 1. We then use this to find foreign demand for domestic capital from {eq}`eq_foreign_cap_demand`: $\bar{K}^{f} = \bar{\zeta}_{K}\sum_{m=1}^{M}\bar{K}_m^{r^*}$ - 2. Using $\bar{D}^{d,i}$ we can then find domestic investors' holdings of private capital as the residual from their total asset holdings: , $\bar{K}^{d,i} = \bar{B}^i - \bar{D}^{d,i}$ - 3. Aggregate capital supply is then determined as $\bar{K}^{i'} = \bar{K}^{d,i} + \bar{K}^{f,i}$. - 4. $\bar{K}_M = \bar{K}^{i'} - \sum_{m=1}^{M-1}\bar{K}_{m}$ - 5. Use the factor demands and $\bar{K}_g$ in the production function for industry $M$ to find $\bar{Y}_M$. - 17. Find an updated value for GDP, $\bar{Y}^{i'} = \sum_{m=1}^{M} \bar{p}_m \bar{Y}_m$. - 18. Find a updated values for $\bar{I}_{g}$ and $\bar{K}_g$ using $\bar{Y}^{i'}$, equations {eq}`EqStnrz_Igt` and {eq}`EqStnrz_Kgmt` + 6. Find $\pi(\bar{K}_m, \bar{K}^{\tau}_m, \bar{L}_m)$ using the steady-state version of {eq}`EqFirmsProfit` + 7. Find the value of the firm in steady-state as: $\bar{V}_{m} = \frac{\pi(\bar{K}_m, \bar{K}^{\tau}_m, \bar{L}_m)}{(1+\bar{r})}$ + 8. Use the steady-state world interest rate $\bar{r}^*$ and labor demand $\bar{L}_m$ to solve for the value of the firm at the world interest rate $\bar{V}_m^{r^*}$: + 1. Use $\bar{Y}_{m}$, $\bar{r}^*$, and $\bar{L}_m$ in {eq}`EqStnrzFOC_K` to solve for $\bar{K}_m^{r^*}$. + 2. Solve for $\bar{K}_m^{\tau, r^*} = \frac{(1-\tau^{inv})\delta_m \bar{K}^{r^*}_{m}}{\delta^{\tau}_m}$ + 3. Find $\pi(\bar{K}^{r^*}_m, \bar{K}^{\tau, r^*}_m, \bar{L}_m)$ using the steady-state version of {eq}`EqFirmsProfit` + 4. Find the value of the firm in steady-state under the world interest rate as $\bar{V}^{r^*}_{m} = \frac{\pi(\bar{K}^{r^*}_m, \bar{K}^{\tau , r^*}_m, \bar{L}_m)}{(1+\bar{r}^*)}$ + 17. Determine factor demands and output for industry $M$: + 1. $\bar{L}_M = \bar{L} - \sum_{m=1}^{M-1}\bar{L}_{m}$ + 2. Use $\bar{L}_{M}$ and $\bar{r}$ {eq}`EqStnrzFOC_K` to solve for $\bar{K}_M$. NOTE: may not be an analytical solution here so might have to use a root finder... + 3. Use the production function to find $\bar{Y}_M$. + 4. Solve for $\bar{K}_M^{\tau} = \frac{(1-\tau^{inv})\delta_M \bar{K}_{M}}{\delta^{\tau}_M}$ + 5. Find $\pi(\bar{K}_M, \bar{K}^{\tau}_M, \bar{L}_M)$ using the steady-state version of {eq}`EqFirmsProfit` + 6. Use the steady-state world interest rate $\bar{r}^*$ and labor demand $\bar{L}_M$ to solve for the value of the firm at the world interest rate $\bar{V}_M^{r^*}$: + 1. Use $\bar{L}_{M}$ and $\bar{r}^*$ {eq}`EqStnrzFOC_K` to solve for $\bar{K}_M^{r^*}$. NOTE: may not be an analytical solution here so might have to use a root finder... + 2. Solve for $\bar{K}_M^{\tau, r^*} = \frac{(1-\tau^{inv})\delta_M \bar{K}^{r^*}_{M}}{\delta^{\tau}_M}$ + 3. Find $\bar{pi}_M^{i'}=\pi(\bar{K}^{r^*}_M, \bar{K}^{\tau, r^*}_M, \bar{L}_M)$ using the steady-state version of {eq}`EqFirmsProfit` + 4. Find the value of the firm in steady-state under the world interest rate as $\bar{V}^{r^*}_{M} = \frac{\pi(\bar{K}^{r^*}_M, \bar{K}^{\tau , r^*}_M, \bar{L}_M)}{(1+\bar{r}^*)}$ + 7. Find total supply of equity, and the split between that from domestic and foreign equity holdings: $\bar{V}^{i'}$, $\bar{V}^d$, $\bar{V}^f$: + 1. Use $\bar{V}_m^{r^*}$ to find foreign demand for domestic equity {eq}`eq_foreign_cap_demand`: $\bar{V}^{f} = \bar{\zeta}_{K}\sum_{m=1}^{M}\bar{ES}_m^{r^*} = \bar{\zeta}_{K}\sum_{m=1}^{M}(\bar{V}_m^{r^*} - \bar{V}_m$ + 2. Using $\bar{D}^{d,i}$ we can then find domestic investors' holdings of equity as the residual from their total asset holdings: , $\bar{V}^{d,i} = \bar{B}^i - \bar{D}^{d,i}$ + 3. Aggregate demand for equities is then determined as $\bar{V}^{i'} = \bar{V}^{d,i} + \bar{V}^{f,i}$. + 8. Use the equity market clearing condition, {eq}`EqStnrz_VtVdVf`, to find the value of the $M$th firm, $\bar{V}_M$: + + ```{math} + :label: EqSS_V_M + \bar{V}_m = \bar{V}^{i'} - \sum_{m=1}^{M-1}\bar{V}_{m} + ``` + + 18. Find an updated value for GDP, $\bar{Y}^{i'} = \sum_{m=1}^{M} \bar{p}_m \bar{Y}_m$. + 19. Find a updated values for $\bar{I}_{g}$ and $\bar{K}_g$ using $\bar{Y}^{i'}$, equations {eq}`EqStnrz_Igt` and {eq}`EqStnrz_Kgmt` 3. Given updated inner-loop values based on initial guesses for outer-loop variables $\{\bar{r}_p^i, \bar{r}^i, \bar{w}^i, \boldsymbol{\bar{p}}, \overline{BQ}^i, \overline{TR}^i, factor^i\}$, solve for updated values of outer-loop variables $\{\bar{r}_p^{i'}, \bar{r}^{i'}, \bar{w}^{i'}, \boldsymbol{\bar{p}}^{i'}, \overline{BQ}^{i'}, \overline{TR}^{i'}, factor^{i'}\}$ using the remaining equations: - 1. Use $\bar{Y}_M^{i'}$ and $\bar{K}_M^{i'}$ in {eq}`EqStnrzFOC_K` to solve for updated value of the rental rate on private capital $\bar{r}^{i'}$. + 1. Use $\bar{pi}_M^{i'}$ and $\bar{V}_M^{i'}$ in {eq}`EqFirmsExpectedReturn` to solve for updated value of the pre-tax return on equity, $\bar{r}^{i'}$. 2. Use $\bar{Y}_M^{i'}$ and $\bar{L}_M^{i}$ in {eq}`EqStnrzFOC_L` to solve for updated value of the wage rate $\bar{w}^{i'}$. 3. Use $\bar{r}^{i'}$ in equations {eq}`EqUnbalGBC_rate_wedge` to get $\bar{r}_{gov}^{i'}$ - 4. Use $\bar{K}_g^{i'}$ and $\bar{Y}^{i''}$ in {eq}`EqFirmsMPKg_opt` for each industry $m$ to solve for the value of the marginal product of government capital in each industry, $\overline{MPK}_{g,m}^{i'}$ - 5. Use $\boldsymbol{\overline{MPK}}_g^{i'}$, $\bar{r}^{i'}$, $\bar{r}_{gov}^{i'}$, $\bar{D}^{i'}$, and $\bar{K}^{i'}$ to find the return on the households' investment portfolio, $\bar{r}_{p}^{i'}$ - 6. Use $\bar{Y}_m$, $\bar{L}_m$ in {eq}`EqStnrzFOC_L` to solve for the updates vector of prices, $\boldsymbol{\bar{p}}^{i'}$ - 7. Use $\bar{r}_{p}^{i'}$ and $\bar{b}_{j,s}$ in {eq}`EqStnrzMarkClrBQ` to solve for updated aggregate bequests $\overline{BQ}^{i'}$. - 8. Use $\bar{Y}^{i'}$ in the long-run aggregate transfers assumption {eq}`EqStnrzTfer` to get an updated value for total transfers to households $\overline{TR}^{i'}$. - 9. Use $\bar{r}^{i'}$, $\bar{r}_{p}^{i}$, $\bar{w}^{i'}$, $\bar{n}_{j,s}$, and $\bar{b}_{j,s+1}$ in equation {eq}`EqSS_factor` to get an updated value for the income factor $factor^{i'}$. + 4. Use $\boldsymbol{\overline{\Pi}}^{i'}$, $\bar{r}^{i'}$, $\bar{r}_{gov}^{i'}$, $\bar{D}^{i'}$, and $\bar{V}^{i'}$ to find the return on the households' investment portfolio, $\bar{r}_{p}^{i'}$ + 5. Use $\bar{Y}_m$, $\bar{K}_m$ in {eq}`EqStnrzFOC_K` to solve for the updated vector of output prices, $\boldsymbol{\bar{p}}^{i'}$ + + ```{math} + :label: EqSS_p_m + p_{m,t}=\frac{\left(\frac{\left(1+r_{t}\right)\left((1-\tau^{b}_{m,t-1})\frac{\partial \psi(K_{m,t}, K_{m,t-1})}{\partial K_{m,t}} + 1 - \tau^{inv}_{m,t-1}-\tau^{b}_{m,t-1}\delta^{\tau}_{m,t-1}(1-\tau^{inv}_{m,t})\right)-1 + \delta_m - \tau^{b}_{m,t}\delta^{\tau}_{m,t}\left((1-\tau^{inv}_{m,t-1})(1-\delta^{\tau}_{m,t-1})-(1-\delta_m)(1-\tau^{inv}_{m,t})\right) + \tau^{inv}_{m,t}(1-\delta_m)}{(1-\tau_{m,t}^{b})} \right) + \frac{\partial \psi(K_{m,t+1},K_{m,t})}{\partial K_{m,t}}}{Z_{m,t}^{\frac{\varepsilon_m-1}{\varepsilon_m}}\left(\gamma_m \frac{Y_{m,t}}{K_{m,t}}\right)^{\frac{1}{\varepsilon_m}}} + ``` + + 6. Use $\bar{r}_{p}^{i'}$ and $\bar{b}_{j,s}$ in {eq}`EqStnrzMarkClrBQ` to solve for updated aggregate bequests $\overline{BQ}^{i'}$. + 7. Use $\bar{Y}^{i'}$ in the long-run aggregate transfers assumption {eq}`EqStnrzTfer` to get an updated value for total transfers to households $\overline{TR}^{i'}$. + 8. Use $\bar{r}^{i'}$, $\bar{r}_{p}^{i}$, $\bar{w}^{i'}$, $\bar{n}_{j,s}$, and $\bar{b}_{j,s+1}$ in equation {eq}`EqSS_factor` to get an updated value for the income factor $factor^{i'}$. ```{math} :label: EqSS_factor @@ -331,8 +357,8 @@ The stationary non-steady state (transition path) solution algorithm has followi 7. Determine from the quantity of the composite consumption good consumed by each household, $\hat{c}_{j,s,t}$, use equation {eq}`EqHH_cmDem` to determine consumption of each output good, $\hat{c}_{m,j,s,t}$ 8. Using $\hat{c}_{m,j,s,t}$ in {eq}`EqCmt`, solve for aggregate consumption of each output good, $\hat{C}_{m,t}$ 9. Given values for $n_{j,s,t}$ and $\hat{b}_{j,s+1,t+1}$ for all $j$, $s$, and $t$, solve for aggregate labor supply, $\hat{L}_t$, and savings, $B_t$ in each period - 1. Use $n_{j,s,t}$ and the stationarized labor market clearing equation {eq}`EqStnrzMarkClrLab` to get a value for $\hat{L}_t^{i}$. - 2. Use $\hat{b}_{j,s+1,t+1}$ and the stationarized expression for total savings by domestic households {eq}`EqStnrz_Bt`to solve for $\hat{B}_t^i$. + 1. Use $n_{j,s,t}$ and the stationarized labor market clearing equation {eq}`EqStnrzMarkClrLab` to get a value for $\hat{L}_t^{i}$. + 2. Use $\hat{b}_{j,s+1,t+1}$ and the stationarized expression for total savings by domestic households {eq}`EqStnrz_Bt`to solve for $\hat{B}_t^i$. 10. Solve for the exogenous government interest rate $r_{gov,t}^{i}$ using equation {eq}`EqUnbalGBC_rate_wedge`. 11. Use {eq}`EqStnrzTfer` to find $\hat{Y}_t^i$ from the guess of $\hat{TR}_t^i$ 12. Using the path of output from each industry, $\hat{Y}_{m,t}$, and the household savings and labor supply decisions, $\{n_{j,s,t},\hat{b}_{j,s+1,t+1}\}_{s=E+1}^{E+S}$, compute the path of stationarizaed total tax revenue, $\hat{Revenue}_{t}^{i}$. @@ -342,12 +368,12 @@ The stationary non-steady state (transition path) solution algorithm has followi 16. Using the law of motion of the stock of infrastructure, {eq}`EqStnrz_Kgmt`, and $\hat{I}_{g,t}$, solve for $\hat{K}_{g,t}^{i}$ 17. Find output and factor demands for M-1 industries: 1. By {eq}`EqMarkClrGoods_Mm1`, $\hat{Y}_{m,t}=\hat{C}_{m,t}$, where $\hat{C}_{m,t}$ is determined by {eq}`EqStnrzEqCmt` - 2. The capital-output ratio can be determined from the FOC for the firms' choice of capital: $\frac{\hat{K}_{m,t}}{\hat{Y}_{m,t}} = \gamma_m\left[\frac{r_t + \delta_{M,t} - \tau^{corp}_{m,t}\delta^{\tau}_{m,t} - \tau^{inv}_{m,t}\delta_{M,t}}{(1-\tau^{corp}_{m,t})p_{m,t}({Z}_{m,t})^\frac{\varepsilon_m -1}{\varepsilon_m}}\right]^{-\varepsilon_m}$ - 3. Capital demand can thus be found: $\hat{K}_{m,t} = \frac{\hat{K}_{m,t}}{\hat{Y}_{m,t}} * \hat{Y}_{m,t}$ - 4. Labor demand can be found by inverting the production function: + 2. The labor-output ratio can be determined from the FOC for the firms' choice of labor: $\frac{\hat{Y}_{m,t}}{\hat{L}_{m,t}} = \left(\hat{Z}_{m,t}\right)^{\varepsilon_m - 1}\frac{(1-\gamma_m - \gamma_{g,m})}{(\hat{w}_{t}p_{m,t})}$ + 3. Labor demand can thus be found: $\hat{L}_{m,t} = \frac{\hat{L}_{m,t}}{\hat{Y}_{m,t}} * \hat{Y}_{m,t}$ + 4. Capital demand can be found by inverting the production function: ```{math} - :label: EqTPI_solveL - \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}} + :label: EqTPI_solveK + \hat{K}_{m,t} = \left(\frac{\left(\frac{\hat{Y}_{m,t}}{Z_{m,t}}\right)^{\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}}\hat{L}_{m,t}^{\frac{\varepsilon_m-1}{\varepsilon_m}}}{\gamma_m^{\frac{1}{\varepsilon_m}}}\right)^{\frac{\varepsilon_m}{\varepsilon_m-1}} ``` 5. Use the interest rate $r_t^*$ and labor demand $\hat{L}_{m,t}$ to solve for private capital demand at the world interest rate $\hat{K}_{m,t}^{r^*}$ using {eq}`EqFirmsMPKg_opt` ```{math} @@ -373,7 +399,7 @@ The stationary non-steady state (transition path) solution algorithm has followi 3. Use $r_t^{i'}$ in equations {eq}`EqUnbalGBC_rate_wedge` to get $r_{gov,t}^{i'}$ 4. Use $\hat{K}_{g,t}^{i'}$ and $\hat{Y}_t^{i''}$ in in {eq}`EqFirmsMPKg_opt` for each industry $m$ to solve for the value of the marginal product of government capital in each industry, $MPK_{g,m,t}^{i'}$ 5. Use $\boldsymbol{MPK}_{g,t}^{i'}$, $r_t^{i'}$, $r_{gov,t}^{i'}$, $\hat{D}_t^{i'}$, and $\hat{K}_t^{i'}$ to find the return on the households' investment portfolio, $r_{p,t}^{i'}$ - 6. Use $\hat{Y}_{m,t}$, $\hat{L}_{m,t}$ in {eq}`EqStnrzFOC_L` to solve for the updates vector of prices, $\boldsymbol{p}_t^{i'}$ + 6. Use $\hat{Y}_{m,t}$, $\hat{K}_{m,t}$ (for $m0$. - ```{math} - :label: EqFirmsProfit_Kg - \begin{split} - PR_{m,t} &= (1 - \tau^{corp}_{m,t})\Bigl[p_{m,t}Y_{m,t} - w_t L_{m,t}\Bigr] - \bigl(r_t + \delta_{M,t}\bigr)K_{m,t} + \tau^{corp}_{m,t}\delta^\tau_{m,t}K_{m,t} + \tau^{inv}_{m,t}\delta_{M,t}K_{m,t} \\ - &= (1 - \tau^{corp}_{m,t})\Biggl[\biggl(\frac{r_t + \delta_{M,t} - \tau^{corp}_{m,t}\delta^{\tau}_{m,t} - \tau^{inv}_{m,t}\delta_{M,t}}{1 - \tau^{corp}_{m,t}}\biggr)K_{m,t} + p_{m,t}MPK_{g,m,t}K_{g,m,t} + w_t L_{m,t}\Biggr] ... \\ - &\quad\quad - (1 - \tau^{corp}_{m,t})w_t L_{m,t} - (r_t + \delta_{M,t})K_{m,t} + \tau^{corp}_{m,t}\delta^{\tau}_{m,t}K_{m,t} + \tau^{inv}_{m,t}\delta_{M,t}K_{m,t} \\ - &= (1 - \tau^{corp}_{m,t})p_{m,t}MPK_{g,m,t}K_{g,m,t} \quad\forall m,t - \end{split} + :label: EqFirmFOC_K + r_{t+1} = \frac{(1 - \tau^{corp}_{m,t+1})\left(p_{m,t+1}(Z_{m,t+1})^\frac{\varepsilon_m-1}{\varepsilon_m}\left[\gamma_m\frac{Y_{m,t+1}}{K_{m,t+1}}\right]^\frac{1}{\varepsilon_m} - \frac{\partial \Psi(I_{m,t+1},K_{m,t+1})}{\partial K_{m,t+1}}\right) + 1 - \delta_{m} + \tau^{corp}_{m,t+1}\delta^\tau_{m,t+1}\left[(1-\tau^{inv}_{m,t})(1-\delta^\tau_{m,t})-(1-\delta_m)(1-\tau^{inv}_{m,t+1})\right] - \tau^{inv}_{m,t+1}(1-\delta_{m})}{(1-\tau^{corp}_{m,t})\frac{\partial \Psi(I_{m,t},K_{m,t})}{\partial K_{m,t+1}}+1 -\tau^{inv}_{m,t}-\tau^{corp}_{m,t}\delta^{\tau}_{m,t}(1-\tau^{inv}_{m,t})} - 1 \quad\forall m,t ``` - We assume these positive economic profits resulting from government infrastructure investment are passed on to the owners of private capital through an adjusted interest rate $r_{K,t}$ provided by the financial intermediary (see Chapter {ref}`Chap_FinInt`) that zeroes out profits among the perfectly competitive firms and is a function of $p_{m,t}$, $MPK_{g,m,t}$ and $K_{g,m,t}$ in each industry $m$. Total payouts from the financial intermediary $r_{K,t}\sum_{m=1}^M K_{m,t}$ are a function of the perfectly competitive payout to owners of private capital $r_t \sum_{m=1}^M K_{m,t}$ plus any positive profits when $K_{g,m,t}>0$ from {eq}`EqFirmsProfit_Kg`. + The derivatives of the quadratic adjustment cost function are given by: ```{math} - :label: EqFirmsPayout - r_{K,t}\sum_{m=1}^M K_{m,t} = r_t \sum_{m=1}^M K_{m,t} + \sum_{m=1}^M(1 - \tau^{corp}_{m,t})p_{m,t}MPK_{g,m,t}K_{g,m,t} \quad\forall t + :label: EqFirmAdjCost_dKp1 + \frac{\partial \Psi(I_{m,t},K_{m,t})}{\partial K_{m,t+1}} = \frac{\psi}{2}\frac{\left(\frac{I_{m,t}}{K_{m,t}}- \mu_{m}\right)}{I_{t}}\left[1 -\mu\frac{K_{m,t}}{I_{m,t}}\right] \forall m,t ``` - This implies that the rate of return paid from the financial intermediary to the households $r_{K,t}$ is the interest rate on private capital $r_t$ plus the ratio of total positive profits across industries (a function of $K_{g,m,t}$ in each industry) divided by total private capital from {eq}`EqFirmsProfit_Kg`, in which the units are put in terms of $K_{m,t}$ (which is in terms of the $M$th industry output, see equation {eq}`eq_rK` in Chapter {ref}`Chap_FinInt`). + and ```{math} - :label: EqFirms_rKt - r_{K,t} = r_t + \frac{\sum_{m=1}^M(1 - \tau^{corp}_{m,t})p_{m,t}MPK_{g,m,t}K_{g,m,t}}{\sum_{m=1}^M K_{m,t}} \quad\forall t + :label: EqFirmAdjCost_dK + \frac{\partial \Psi(I_{m,t},K_{m,t})}{\partial K_{m,t}} = \frac{-\psi}{2}\left(\frac{K_{m,t+1}}{I^2_{m,t}}\right)\left(\frac{I_{m,t}}{K_{m,t}}-\mu\right)\left(\frac{I_{m,t}}{K_{m,t}}+\mu\right) \forall m,t ``` + Note that the presence of the public capital good creates economic rents. These rents will accrue to the owners of capital via the financial intermediary. See Section Chapter {ref}`Chap_FinInt` for more details on the determination of the return to the household's portfolio. Because public capital is exogenous to the firm's decisions, the optimality condition for capital demand {eq}`EqFirmFOC_K` is only affected by public capital $K_{g,m,t}$ through the $Y_{m,t}$ term. + +(EqFirmsPosProfits)= +## Positive Profits from Government Infrastructure Investment + +Note that when $K_{g,t}$ is greater than zero, the public capital factor of production generates above normal profits for the firm. That is, the actual rate of return on equity, $E_t(R_t)$, will exceed the discount factor used by the firm, $1+r_t$. This is because the firm does not pay for the public capital that it uses in production. The above normal return will be distributed to shareholders as part of the firms profits and thus the return on equity. We detail this further in the {ref}`Chap_FinInt` Chapter. + (SecFirmsfootnotes)= ## Footnotes diff --git a/docs/book/content/theory/market_clearing.md b/docs/book/content/theory/market_clearing.md index 3d3a7d9b9..09288feef 100644 --- a/docs/book/content/theory/market_clearing.md +++ b/docs/book/content/theory/market_clearing.md @@ -62,32 +62,32 @@ We also characterize here the law of motion for total bequests $BQ_t$. Although (SecMarkClrMktClr_K)= - ### Private capital market clearing + ### Equity market clearing - Domestic firms in each industry $m$ rent private capital $K_t\equiv\sum_{m=1}^M K_{m,t}$ from domestic households $K^d_t$ and from foreign investors $K^f_t$. + Equity in domestic firms, $V_t\equiv\sum_{m=1}^M K_{m,t}$, is held by domestic households, $V^d_t$ and foreign investors $V^f_t$. The equity market clearing condition is thus: ```{math} :label: EqMarkClr_KtKdKf - K_t = K^d_t + K^f_t \quad\forall t \quad\text{where}\quad K_t \equiv \sum_{m=1}^M K_{m,t} + V_t = V^d_t + V^f_t \quad\forall t \quad\text{where}\quad V_t \equiv \sum_{m=1}^M V_{m,t} ``` - Assume that there exists some exogenous world interest rate $r^*_t$. We assume that foreign capital supply $K^f_t$ is an exogenous percentage $\zeta_K\in[0,1]$ of the excess total domestic private capital demand $ED^{K,r^*}_t$ that would exist if domestic private capital demand were determined by the exogenous world interest rate $r^*_t$ and domestic private capital supply were determined by the model consistent return on household savings $r_{p,t}$. This percentage $\zeta_K$ is something we calibrate. Define excess total domestic capital demand at the exogenous world interest rate $r^*_t$ as $ED^{K,r^*}_t$, where $K^{r^*}_t\equiv\sum_{m=1}^M K^{r^*}_{m,t}$ is the capital demand by domestic firms at the world interest rate $r^*_t$, and $K^{d}_t$ is the domestic supply of private capital to firms, which is modeled as being a function of the actual rate faced by households $r_{p,t}$. Then our measure of excess demand at the world interest rate is the following. + Assume that there exists some exogenous world interest rate $r^*_t$. We assume that foreign equity holdings, $V^f_t$, is an exogenous percentage $\zeta_K\in[0,1]$ of the excess total supply of domestic equity, $ES^{K,r^*}_t$ that would exist if domestic firm values were determined by investment decisions made under the exogenous world interest rate $r^*_t$ and domestic equity demand were determined by the model consistent return on household savings $r_{p,t}$. This percentage $\zeta_K$ is something we calibrate. Define excess supply of equity at the exogenous world interest rate $r^*_t$ as $ES^{V,r^*}_t$, where $V^{r^*}_t\equiv\sum_{m=1}^M V^{r^*}_{m,t}$ is value of domestic firms at the world interest rate $r^*_t$, and $V^{d}_t$ is the domestic demand for equity, which is modeled as being a function of the actual rate of return faced by households $r_{p,t}$. Then our measure of excess supply at the world interest rate is the following. ```{math} :label: EqMarkClr_ExDemK - ED^{K,r^*}_t \equiv K^{r^*}_t - K^d_t \quad\forall t \quad\text{where}\quad K^{r^*}_t\equiv \sum_{m=1}^M K^{r^*}_{m,t} + ES^{V,r^*}_t \equiv V^{r^*}_t - V^d_t \quad\forall t \quad\text{where}\quad V^{r^*}_t\equiv \sum_{m=1}^M V^{r^*}_{m,t} ``` - Then we assume that total foreign private capital supply $K^f_t$ is a fixed fraction of this excess capital demand at the world interest rate $r^*$. + Then we assume that total foreign private capital supply $V^f_t$ is a fixed fraction of this equity supply at the world interest rate $r^*$. ```{math} :label: EqMarkClr_zetaK - K^{f}_t = \zeta_{K}ED^{K,r^*}_t \quad\forall t + V^{f}_t = \zeta_{K}ES^{K,r^*}_t \quad\forall t ``` - This approach nicely nests the small open economy specification discussed in Section {ref}`SecSmallOpen` of Chapter {ref}`Chap_SmOpEcn` in which $\zeta_K=1$, foreigners flexibly supply all the excess demand for private capital, the marginal product of capital is fixed at the exogenous world interest rate $r^*$, and domestic households face the least amount of crowd out by government debt. The opposite extreme is the closed private capital market assumption of $\zeta_K=0$ in which $K^f_t=0$ and households must supply all the capital demanded in the domestic market. In this specification, the interest rate is the most flexible and adjusts to equilibrate domestic private capital supply $K^d_t$ with private capital demand $K_t$. + This approach nicely nests the small open economy specification discussed in Section {ref}`SecSmallOpen` of Chapter {ref}`Chap_SmOpEcn` in which $\zeta_K=1$, foreigners flexibly demand the excess supply of domestic equity, the domestic interest rate is fixed at the exogenous world interest rate $r^*$, and domestic households face the least amount of crowd out by government debt. The opposite extreme is the closed private capital market assumption of $\zeta_K=0$ in which $V^f_t=0$ and households must hold all the domestic firms' equity. In this specification, the interest rate is the most flexible and adjusts to equilibrate domestic equity demand, $V^d_t$, with the supply of equity, $V_t$. - For the intermediate specifications of $\zeta_K\in(0,1)$, foreigners provide a fraction of the excess demand defined in {eq}`EqMarkClr_ExDemK`. This allows for partial inflows of foreign private capital, partial crowd-out of government spending on private investment, and partial adjustment of the domestic interest rate $r_t$. This latter set of model specifications could be characterized as large-open economy or partial capital mobility. + For the intermediate specifications of $\zeta_K\in(0,1)$, foreigners provide a fraction of the excess supply of equity in {eq}`EqMarkClr_ExDemK`. This allows for partial inflows of foreign equity holdings, partial crowd-out of government spending on private investment, and partial adjustment of the domestic interest rate $r_t$. This latter set of model specifications could be characterized as large-open economy or partial capital mobility. (SecMarkClrMktClr_goods)= @@ -111,11 +111,11 @@ We also characterize here the law of motion for total bequests $BQ_t$. Although Y_{m,t} = C_{m,t} \quad\forall t \quad\text{and}\quad m=1,2,...M-1 ``` - The output of the $M$th industry can be used for private investment, infrastructure investment, government spending, and government debt.[^M_ind] As such, the market clearing condition in the $M$th industry will look more like the traditional $Y=C+I+G+NX$ expression.[^RCrates_note] + The output of the $M$th industry can be used for private investment, infrastructure investment, government spending, and government debt.[^M_ind] As such, the market clearing condition in the $M$th industry will look more like the traditional $Y=C+I+G+NX$ expression.[^RCrates_note] Note also that adjustment costs are paid in units of capital, which is the same units as the output of the $M$th industry. Therefore we must include the adjustment costs in the market clearing condition for the $M$th industry. ```{math} :label: EqMarkClrGoods_M - Y_{M,t} = C_{M,t} + I_{M,t} + I_{g,t} + G_t + r_{p,t} K^f_t + r_{p,t}D^f_t - (K^f_{t+1} - K^f_t) - \bigl(D^f_{t+1} - D^f_t\bigr) \quad\forall t + Y_{M,t} = C_{M,t} + I_{M,t} + I_{g,t} + G_t + r_{g,t}D^f_t - \Pi^f_{t} + (V^f_{t+1} - V^f_t) - \bigl(D^f_{t+1} - D^f_t\bigr) + \Psi_{M,t} \quad\forall t ``` where ```{math} @@ -124,6 +124,16 @@ We also characterize here the law of motion for total bequests $BQ_t$. Although &= K_{t+1} - (1 - \delta_{M,t})K_t \\ &= (K^d_{t+1} + K^f_{t+1}) - (1 - \delta_{M,t})(K^d_t + K^f_t) ``` +and + ```{math} + :label: EqMarkClrGoods_IMt + \Psi_{M,t} &\equiv \sum_{m=1}^M \Psi(I_{m,t},K_{m,t}) \quad\forall t \\ + ``` + and + ```{math} + :label: EqMarkClrGoods_Pi + \Pi^f_{t} &\equiv \sum_{m=1}^M \pi_{m,t} * \frac{V^f}{V} \quad\forall t \\ + ``` In the partially open economy, we must add to the right-hand-side of {eq}`EqMarkClrGoods_M` the output paid to the foreign owners of capital $r_{p,t} K^f_t$ and to the foreign holders of government debt $r_{p,t}D^f_t$. And we must subtract off the foreign inflow component $K^f_{t+1} - K^f_t$ from private capital investment as shown in the first term in parentheses on the right-hand-side of {eq}`EqMarkClrGoods_M`. You can see in the definition of private investment {eq}`EqMarkClrGoods_IMt` where this amount of foreign capital is part of $I_{M,t}$. diff --git a/docs/book/content/theory/open_economy.md b/docs/book/content/theory/open_economy.md index 045aef4e9..929eca7b1 100644 --- a/docs/book/content/theory/open_economy.md +++ b/docs/book/content/theory/open_economy.md @@ -1,11 +1,11 @@ (Chap_SmOpEcn)= # Open Economy Options -`OG-Core` offers a wide range of specifications regarding the type and degree of openness assumed in the economy. In none of our specifications do we fully model foreign economies as is done by {cite}`BenzellEtAl:2017` and others. However, one of the findings of {cite}`BenzellEtAl:2017` is that a full multi-country model is closely approximated by the types of large partial open economy specifications we use in `OG-Core`. Our specifications range from fully closed, to partially closed, to small open economy, to large open economy. We discuss some of these specifications in Chapter {ref}`Chap_MarkClr`. But the open economy assumptions only refer to how foreign capital can flow into the private capital market $K_t\equiv\sum_{m=1}^M K_{m,t}$ and into the government bond market $D_t$. The labor market and goods markets are closed. +`OG-Core` offers a wide range of specifications regarding the type and degree of openness assumed in the economy. In none of our specifications do we fully model foreign economies as is done by {cite}`BenzellEtAl:2017` and others. However, one of the findings of {cite}`BenzellEtAl:2017` is that a full multi-country model is closely approximated by the types of large partial open economy specifications we use in `OG-Core`. Our specifications range from fully closed, to partially closed, to small open economy, to large open economy. We discuss some of these specifications in Chapter {ref}`Chap_MarkClr`. But the open economy assumptions only refer to how foreign investment can flow into the equity market $V_t\equiv\sum_{m=1}^M V_{m,t}$ and into the government bond market $D_t$. The labor market and goods markets are closed. (SecSmallOpen)= ## Small Open Economy -In the small open economy version of `OG-Core`, the economy faces an exogenous world interest rate on capital $r^{*}_{t}$. The parameterization for this setting is $\zeta_K=1$. This implies that foreign capital flows freely into (out of) the country to take up all the excess demand (excess supply) and that firms face the world interest rate $r^{*}_{t}$ as the competitive, zero-profit rate of return on capital as the interest rate analogous to $r_t$ that goes into the profit function {eq}`EqFirmsProfit` of each firm in each industry, $r_{K,t}$ in {eq}`EqFirmsPayout` and {eq}`eq_rK`, $r_{gov,t}$ in {eq}`EqUnbalGBC_rate_wedge`, and $r_{p,t}$ in {eq}`eq_portfolio_return`. In this case, the rate of return on capital inside the country is exogenously fixed at $r^{*}_{t}$ {eq}`EqSmOpen_rstar_r`, and foreign private capital inflows $K^f_t$ are just the difference between total private capital demand $K_t\equiv\sum_{m=1}^M K_{m,t}$ by firms at the world interest rate and total domestic private capital supply by domestic households $K^d_t$ at the world interest rate. +In the small open economy version of `OG-Core`, the economy faces an exogenous world interest rate on capital $r^{*}_{t}$. The parameterization for this setting is $\zeta_K=1$. This implies that foreign investment flows freely into (out of) the country to take up all the excess demand (supply) and that the equilibrium rate of return on equity in the domestic market is equilibrated with the world interest rate $r^{*}_{t}$. To solve this parameterization of the model, we can assume the rate of return on capital inside the country is exogenously fixed at $r^{*}_{t}$ {eq}`EqSmOpen_rstar_r`, and foreign investor inflows, $V^f_t$, are just the difference between total value of firms when returning $r^{*}_{t}$, $V_t\equiv\sum_{m=1}^M V_{m,t}$, and total domestic holdings of equity by domestic households, $V^d_t$, at the world interest rate, $r^{*}_{t}$. ```{math} :label: EqSmOpen_rstar_r @@ -14,24 +14,24 @@ In the small open economy version of `OG-Core`, the economy faces an exogenous w ```{math} :label: EqSmOpen_Kft - K^f_t = K_t - K^d_t \quad\forall t \quad\text{where}\quad K_t\equiv\sum_{m=1}^M K_{m,t} + V^f_t = V_t - V^d_t \quad\forall t \quad\text{where}\quad V_t\equiv\sum_{m=1}^M V_{m,t} ``` (SecPartialOpen)= ## Partially Open Economy -The partially open economy is the default specification of `OG-Core` in which $0<\zeta_K,\zeta_D<1$. In this case, foreign flows of private capital $K^f_t$ and foreign holdings of government bonds $D^f_t$ partially supply the respective domestic demands for these two types of capital. The equations for this partially open specification are described in Sections {ref}`SecMarkClrMktClr_G` and {ref}`SecMarkClrMktClr_K` of Chapter {ref}`Chap_MarkClr`. +The partially open economy is the default specification of `OG-Core` in which $0<\zeta_K,\zeta_D<1$. In this case, foreign equity holdings, $V^f_t$, and foreign holdings of government bonds, $D^f_t$, partially satisfy the respective domestic demands for these two types of assets. The equations for this partially open specification are described in Sections {ref}`SecMarkClrMktClr_G` and {ref}`SecMarkClrMktClr_K` of Chapter {ref}`Chap_MarkClr`. -The partially open economy specification can also be referred to as a large open economy because changes in underlying policy or parameter assumptions will influence the equilibrium interest rate on private capital $r_t$, while the world interest rate $r^*_t$ remains fixed. The degree to which the domestic rental rate on private capital $r_t$ responds to policy parameter changes depends on the degree to which the economy is open. In the most open case, the small open economy specification described in Section {ref}`SecSmallOpen` with $\zeta_K=1$, foreign flows of private capital $K^f_t$ are the most flexible and the domestic interest rate is exogenously fixed at the world interest rate $r^*_t$. As $\zeta_K$ goes to 0, foreign private capital flows $K^f_t$ become less flexible and the domestic interest rate $r_t$ has to adjust more to make domestic private capital demand $K_t$ equal total private capital supply $K^d_t + K^f_t$. +The partially open economy specification can also be referred to as a large open economy because changes in underlying policy or parameter assumptions will influence the equilibrium interest rate on private capital $r_t$, while the world interest rate $r^*_t$ remains fixed. The degree to which the domestic interest rate, $r_t$, responds to policy parameter changes depends on the degree to which the economy is open. In the most open case, the small open economy specification described in Section {ref}`SecSmallOpen` with $\zeta_K=1$, foreign holdings of domestic equity, $V^f_t$, are the most responsive and the domestic interest rate is equilibrated to the world interest rate $r^*_t$. As $\zeta_K$ goes to 0, foreign equity holdings $V^f_t$ become less responsive to interest rate differentials and the domestic interest rate $r_t$ has to adjust more to make domestic equity supply, $V_t$, equal total demand to hold equities, $V^d_t + V^f_t$. -Note that in our partially open economy specification, the world interest rate $r^*_t$ is necessary for determining equilibrium because the foreign supply of private capital $K^f_t$ depends on a concept of excess demand that is based on domestic demand at the world interest rate {eq}`EqMarkClr_ExDemK`. It is also worth noting that our partially open economy specification is not a multi-country model in which the rest of the world or multiple other countries are explicitly modeled. In our specification, the rest of the world is simply modeled as the relationship between the domestic rental rate on private capital $r_t$ and the world interest rate $r^*_t$ as influenced by the supply of foreign private capital $\zeta_K$ and by foreign purchases of new issues of government bonds $\zeta_D$. +Note that in our partially open economy specification, the world interest rate $r^*_t$ is necessary for determining equilibrium because the foreign demand to hold domestic equities, $V^f_t$, depends on a concept of excess demand that is based on domestic demand at the world interest rate {eq}`EqMarkClr_ExDemK`. It is also worth noting that our partially open economy specification is not a multi-country model in which the rest of the world or multiple other countries are explicitly modeled. In our specification, the rest of the world is simply modeled as the relationship between the domestic interest rate, $r_t$, and the world interest rate, $r^*_t$, as influenced by foreign demand for domestic equity via $\zeta_K$ and by foreign purchases of new issues of government bonds via $\zeta_D$. (SecClosed)= ## Closed Economy -The closed economy specification in `OG-Core` is parameterized by $\zeta_D=0$ and $\zeta_K=0$ and is characterized as no foreign inflows of private capital. The government debt market clearing condition and the private capital market clearing condition are the following. +The closed economy specification in `OG-Core` is parameterized by $\zeta_D=0$ and $\zeta_K=0$ and is characterized as no foreign investment inflows. The government debt market clearing condition and the equity market clearing condition are the following. ```{math} :label: EqClosed_D @@ -40,7 +40,7 @@ The closed economy specification in `OG-Core` is parameterized by $\zeta_D=0$ an ```{math} :label: EqClosed_K - K_t = K^d_t \quad\forall t + V_t = V^d_t \quad\forall t ``` In the closed economy setting, the world interest rate $r^*_t$ is not relevant. diff --git a/docs/book/content/theory/stationarization.md b/docs/book/content/theory/stationarization.md index bf4787b10..7d19112d8 100644 --- a/docs/book/content/theory/stationarization.md +++ b/docs/book/content/theory/stationarization.md @@ -49,6 +49,14 @@ The previous chapters derive all the equations necessary to solve for the steady - - $\hat{D}_t\equiv\frac{D_t}{e^{g_y t}\tilde{N}_t}$ - $p_{m,t} \equiv \frac{\tilde{p}_{m,t}}{\tilde{p}_{M,t}}$ +* - + - + - $\hat{I}_{m,t}\equiv\frac{I_{m,t}}{e^{g_y t}\tilde{N}_t}$ + - +* - + - + - $\hat{K}^{\tau}_{m,t}\equiv\frac{K^{\tau}_{m,t}}{e^{g_y t}\tilde{N}_t}$ + - ``` The usual definition of equilibrium would be allocations and prices such that households optimize {eq}`EqHH_ciDem2`, {eq}`EqHHeul_n`, {eq}`EqHHeul_b`, and {eq}`EqHHeul_bS`, firms optimize {eq}`EqFirmFOC_L` and {eq}`EqFirmFOC_K`, and markets clear {eq}`EqMarkClrLab`, {eq}`EqMarkClr_DtDdDf`, {eq}`EqMarkClr_KtKdKf`, {eq}`EqMarkClrGoods_Mm1`, {eq}`EqMarkClrGoods_M`, and {eq}`EqMarkClrBQ`. In this chapter, we show how to stationarize each of these characterizing equations so that we can use our fixed point methods described in Sections {ref}`SecEqlbSSsoln` and {ref}`SecEqlbNSSsoln` of Chapter {ref}`Chap_Eqm` to solve for the equilibria in the steady-state and transition path equilibrium definitions. @@ -132,8 +140,41 @@ The usual definition of equilibrium would be allocations and prices such that ho ```{math} :label: EqStnrzProfit - \hat{PR}_{m,t} &= (1 - \tau^{corp}_{m,t})\Bigl[F(\hat{K}_{m,t},\hat{K}_{g,m,t},\hat{L}_{m,t}) - \hat{w}_t \hat{L}_{m,t}\Bigr] - ... \\ - &\qquad\qquad\quad \bigl(r_t + \delta_{M,t}\bigr)\hat{K}_{m,t} + \tau^{corp}_{m,t}\delta^\tau_{m,t}\hat{K}_{m,t} + \tau^{inv}_{m,t}\delta_{M,t}\hat{K}_{m,t} \quad\forall m,t + \pi(\hat{K}_{m,t}, \hat{L}_{m,t}) &= (1 - \tau^{corp}_{m,t})\Bigl[p_{m,t}F(\hat{K}_{m,t},\hat{K}_{g,m,t},\hat{L}_{m,t}) - w_t \hat{L}_{m,t} - \Psi(\hat{I}_{m,t}, \hat{K}_{m,t})\Bigr] - \\ + &\qquad\qquad\quad \hat{I}_{m,t+1} + \tau^{corp}_{m,t}\delta^\tau_{m,t}\hat{K}^{\tau}_{m,t} + \tau^{inv}_{m,t}\hat{I}_{m,t} \quad\forall m,t + ``` + + The stationarized version of the law of motion for the capital stock for industry $m$ is given by: + + ```{math} + :label: EqStnrz_Kgm + \hat{K}_{m,t+1} = \frac{(1 - \delta_M)\hat{K}_{m,t} + \hat{I}_{m,t}}{e^{g_y}(1 + \tilde{g}_{n,t+1})} \quad\forall m,t + ``` + + And the analogous stationarized version of the law of motion for the tax basis of the capital stock is given by: + + ```{math} + :label: EqStnrz_Ktaum + \hat{K}^{\tau}_{m,} = \frac{(1 - \delta^{\tau}_{m,t})\hat{K}^{\tau}_{m,t-1} + (1-\tau^{inv}_{m,t})\hat{I}_{m,t}}{e^{g_y}(1 + \tilde{g}_{n,t+1})} \quad\forall m,t + ``` + +The stationarized version of the capital adjustment cost function and it's first derivatives are given by: + + ```{math} + :label: EqStnrzAdjCosts + \Psi(\hat{I}_{m,t}, \hat{K}_{m,t}) = \frac{\psi}{2}\frac{\left(\frac{\hat{I}_{m,t}}{\hat{K}_{m,t}} - \mu_m \right)^2}{\frac{\hat{I}_{m,t}}{\hat{K}_{m,t}}} \quad\forall m,t + ``` + + ```{math} + :label: EqStnrzAdjCost_dKp1 + \frac{\partial \Psi(\hat{I}_{m,t},\hat{K}_{m,t})}{\partial \hat{K}_{m,t+1}} = \frac{\psi}{2}\frac{\left(\frac{\hat{I}_{m,t}}{\hat{K}_{m,t}}- \mu_{m}\right)}{\hat{I}_{t}}\left[1 -\mu\frac{\hat{K}_{m,t}}{\hat{I}_{m,t}}\right] \forall m,t + ``` + + and + + ```{math} + :label: EqStnrzAdjCost_dK + \frac{\partial \Psi(\hat{I}_{m,t},\hat{K}_{m,t})}{\partial \hat{K}_{m,t}} = \frac{-\psi}{2}\left(\frac{\hat{K}_{m,t+1}}{e^{g_y}(1+g_{n,t+1})\hat{I}^2_{m,t}}\right)\left(\frac{\hat{I}_{m,t}}{\hat{K}_{m,t}}-\mu\right)\left(\frac{\hat{I}_{m,t}}{\hat{K}_{m,t}}+\mu\right) \forall m,t ``` The firms' first order equation for labor demand {eq}`EqFirmFOC_L` is stationarized by dividing both sides by $e^{g_y t}$. This stationarizes the wage $\hat{w}_t$ on the left-hand-side and cancels out the $e^{g_y t}$ term in front of the right-hand-side. To complete the stationarization, we multiply and divide the $\frac{Y_{m,t}}{e^{g_y t}L_{m,t}}$ term on the right-hand-side by $\tilde{N}_t$. @@ -147,7 +188,7 @@ The usual definition of equilibrium would be allocations and prices such that ho ```{math} :label: EqStnrzFOC_K - r_t = (1 - \tau^{corp}_{m,t})p_{m,t}(Z_{m,t})^\frac{\varepsilon_m-1}{\varepsilon_m}\left[\gamma_m\frac{\hat{Y}_{m,t}}{\hat{K}_{m,t}}\right]^\frac{1}{\varepsilon_m} - \delta_{M,t} + \tau^{corp}_{m,t}\delta^\tau_{m,t} + \tau^{inv}_{m,t}\delta_{M,t} \quad\forall m,t + r_{t+1} = \frac{(1 - \tau^{corp}_{m,t+1})\left(p_{m,t+1}(Z_{m,t+1})^\frac{\varepsilon_m-1}{\varepsilon_m}\left[\gamma_m\frac{\hat{Y}_{m,t+1}}{\hat{K}_{m,t+1}}\right]^\frac{1}{\varepsilon_m} - \frac{\partial \Psi(\hat{I}_{m,t+1},\hat{K}_{m,t+1})}{\partial \hat{K}_{m,t+1}}\right) + 1 - \delta_{m} + \tau^{corp}_{m,t+1}\delta^\tau_{m,t+1}\left[(1-\tau^{inv}_{m,t})(1-\delta^\tau_{m,t})-(1-\delta_m)(1-\tau^{inv}_{m,t+1})\right] - \tau^{inv}_{m,t+1}(1-\delta_{m})}{(1-\tau^{corp}_{m,t})\frac{\partial \Psi(\hat{I}_{m,t},\hat{K}_{m,t})}{\partial \hat{K}_{m,t+1}}+1 -\tau^{inv}_{m,t}-\tau^{corp}_{m,t}\delta^{\tau}_{m,t}(1-\tau^{inv}_{m,t})} - 1 \quad\forall m,t ``` A stationary version of the firms' gross revenue attributed to each factor of production {eq}`EqFirmsMargRevEq` is found by dividing both sides of the equation by $e^{g_y t}\tilde{N}_t$. @@ -342,18 +383,18 @@ The usual definition of equilibrium would be allocations and prices such that ho The private capital market clearing equation {eq}`EqMarkClr_KtKdKf` is stationarized by dividing both sides by $e^{g_y t}\tilde{N}_t$, as is the expression for excess demand at the world interest rate {eq}`EqMarkClr_ExDemK` and the exogenous expression for foreign private capital flows {eq}`EqMarkClr_zetaK`. ```{math} - :label: EqStnrz_KtKdKf - \hat{K}_t = \hat{K}^d_t + \hat{K}^f_t \quad\forall t \quad\text{where}\quad \hat{K_t} \equiv \sum_{m=1}^M \hat{K}_{m,t} + :label: EqStnrz_VtVdVf + \hat{V}_t = \hat{V}^d_t + \hat{V}^f_t \quad\forall t \quad\text{where}\quad \hat{V_t} \equiv \sum_{m=1}^M \hat{V}_{m,t} ``` ```{math} :label: EqStnrz_ExDemK - \hat{ED}^{K,r^*}_t \equiv \hat{K}^{r^*}_t - \hat{K}^d_t \quad\forall t \quad\text{where}\quad \hat{K}^{r^*}_t \equiv \sum_{m=1}^M \hat{K}^{r^*}_{m,t} + \hat{ES}^{V,r^*}_t \equiv \hat{V}^{r^*}_t - \hat{V}^d_t \quad\forall t \quad\text{where}\quad \hat{V}^{r^*}_t \equiv \sum_{m=1}^M \hat{V}^{r^*}_{m,t} ``` ```{math} :label: EqStnrz_zetaK - \hat{K}^{f}_t = \zeta_{K}\hat{ED}^{K,r^*}_t \quad\forall t + \hat{V}^{f}_t = \zeta_{K}\hat{ES}^{V,r^*}_t \quad\forall t ``` We stationarize the goods market clearing equations for the first $M-1$ industries {eq}`EqMarkClrGoods_Mm1` and for the $M$th industry {eq}`EqMarkClrGoods_M` by dividing both sides by $e^{g_y t}\tilde{N}_t$. On the right-hand-side, we must multiply and divide the $K^d_{t+1}$ term and the $D^f_{t+1}$ term, respectively, by $e^{g_y(t+1)}\tilde{N}_{t+1}$ leaving the coefficient $e^{g_y}(1+\tilde{g}_{n,t+1})$. @@ -364,7 +405,7 @@ The usual definition of equilibrium would be allocations and prices such that ho ```{math} :label: EqStnrzMarkClrGoods_M \hat{Y}_{M,t} &= \hat{C}_{M,t} + \hat{I}_{M,t} + \hat{I}_{g,t} + \hat{G}_t + r_{p,t} \hat{K}^f_t + r_{p,t}\hat{D}^f_t ... \\ - &\quad - \Bigl(e^{g_y}\bigl[1 + \tilde{g}_{n,t+1}\bigr]\hat{K}^f_{t+1} - \hat{K}^f_t\Bigr) - \Bigl(e^{g_y}\bigl[1 + \tilde{g}_{n,t+1}\bigr]\hat{D}^f_{t+1} - \hat{D}^f_t\Bigr) \quad\forall t + &\quad - \Bigl(e^{g_y}\bigl[1 + \tilde{g}_{n,t+1}\bigr]\hat{K}^f_{t+1} - \hat{K}^f_t\Bigr) - \Bigl(e^{g_y}\bigl[1 + \tilde{g}_{n,t+1}\bigr]\hat{D}^f_{t+1} - \hat{D}^f_t\Bigr) + \hat{\Psi}_{M,t} \quad\forall t ``` where ```{math} @@ -378,6 +419,11 @@ The usual definition of equilibrium would be allocations and prices such that ho &= e^{g_y}\bigl(1 + \tilde{g}_{n,t+1}\bigr)\hat{K}_{t+1} - (1 - \delta_{M,t})\hat{K}_t \\ &= e^{g_y}\bigl(1 + \tilde{g}_{n,t+1}\bigr)(\hat{K}^d_{t+1} + \hat{K}^f_{t+1}) - (1 - \delta_{M,t})(\hat{K}^d_t + \hat{K}^f_t) ``` + and + ```{math} + :label: EqStnrzMarkClrGoods_IMt + \hat{\Psi}_{M,t} &\equiv \sum_{m=1}^M \Psi(\hat{I}_{m,t},\hat{K}_{m,t}) \quad\forall t \\ + ``` We stationarize the law of motion for total bequests $BQ_t$ in {eq}`EqMarkClrBQ` by dividing both sides by $e^{g_y t}\tilde{N}_t$. Because the population levels in the summation are from period $t-1$, we must multiply and divide the summed term by $\tilde{N}_{t-1}$ leaving the term in the denominator of $1+\tilde{g}_{n,t}$. diff --git a/ogcore/SS.py b/ogcore/SS.py index 61da4a400..9a64e83b2 100644 --- a/ogcore/SS.py +++ b/ogcore/SS.py @@ -327,22 +327,65 @@ def inner_loop(outer_loop_vars, p, client): # Find output, labor demand, capital demand for M-1 industries L_vec = np.zeros(p.M) K_vec = np.zeros(p.M) + K_tau_vec = np.zeros(p.M) + profit_vec = np.zeros(p.M) + V_vec = np.zeros(p.M) + V_open_vec = np.zeros(p.M) C_vec = np.zeros(p.I) K_demand_open_vec = np.zeros(p.M) for i_ind in range(p.I): C_vec[i_ind] = aggr.get_C(c_i[i_ind, :, :], p, "SS") Y_vec = np.dot(p.io_matrix.T, C_vec) for m_ind in range(p.M - 1): - KYrat_m = firm.get_KY_ratio(r, p_m, p, "SS", m_ind) - K_vec[m_ind] = KYrat_m * Y_vec[m_ind] - L_vec[m_ind] = firm.solve_L( - Y_vec[m_ind], K_vec[m_ind], K_g, p, "SS", m_ind + YL_rat_m = firm.get_YL_from_w(w, p_m, p, "SS", m_ind) + L_vec[m_ind] = Y_vec[m_ind] * YL_rat_m + K_vec[m_ind] = firm.solve_K( + Y_vec[m_ind], L_vec[m_ind], K_g, p, "SS", m_ind ) + K_tau_vec[m_ind] = ( + (1 - p.tau_inv[-1, m_ind]) * p.delta[m] * K_vec[m_ind] + ) / p.delta_tau[-1, m_ind] + profit_vec[m_ind] = firm.profits( + r, + w, + K_vec[m_ind], + L_vec[m_ind], + Y_vec[m_ind], + K_tau_vec[m_ind], + p_m, + p, + "SS", + m_ind, + ) + V_vec[m_ind] = profit_vec[m_ind] / (1 + r) + # KYrat_m = firm.get_KY_ratio(r, p_m, p, "SS", m_ind) + # K_vec[m_ind] = KYrat_m * Y_vec[m_ind] + # L_vec[m_ind] = firm.solve_L( + # Y_vec[m_ind], K_vec[m_ind], K_g, p, "SS", m_ind + # ) + # TODO: update how solve for K below, need to use equation 125, probably with a root finder K_demand_open_vec[m_ind] = firm.get_K( p.world_int_rate[-1], w_open, L_vec[m_ind], p, "SS", m_ind ) + K_tau_open = ( + (1 - p.tau_inv[-1, m_ind]) * p.delta[m] * K_demand_open_vec[m_ind] + ) / p.delta_tau[-1, m_ind] + Y_vec_open = firm.get_Y(K_demand_open_vec[m_ind], K_g, L_vec[m_ind], p, "SS", m=m_ind) + profit_open = firm.profits( + p.world_int_rate[-1], w_open, + K_demand_open_vec[m_ind], + L_vec[m_ind], + Y_vec_open, + K_tau_open, + p_m, + p, + "SS", + m_ind, + ) + V_open_vec[m_ind] = profit_open / (1 + p.world_int_rate[-1]) # Find output, labor demand, capital demand for industry M L_M = max(0.001, L - L_vec.sum()) # make sure L_M > 0 + # TODO: update how solve for K below, need to use equation 125, probably with a root finder K_demand_open_vec[-1] = firm.get_K( p.world_int_rate[-1], w_open, L_M, p, "SS", -1 ) diff --git a/ogcore/firm.py b/ogcore/firm.py index 5d454f679..821af8e99 100644 --- a/ogcore/firm.py +++ b/ogcore/firm.py @@ -485,7 +485,7 @@ def get_K(r, w, L, p, method, m=-1): return K -def get_cost_of_capital(r, p, method, m=-1): +def get_cost_of_capital(r, K, Kp1, Km1, p, method, m=-1): r""" Compute the cost of capital. @@ -505,43 +505,108 @@ def get_cost_of_capital(r, p, method, m=-1): if m is None: if method == "SS": tau_b = p.tau_b[-1, :] + tau_b_m1 = tau_b delta_tau = p.delta_tau[-1, :] + delta_tau_m1 = delta_tau tau_inv = p.inv_tax_credit[-1, :] + tau_inv_m1 = tau_inv else: tau_b = p.tau_b[: p.T, :] + # tau_b_m1 = p.tau_b[: p.T - 1, :] Append what to the front of this?? delta_tau = p.delta_tau[: p.T, :] tau_inv = p.inv_tax_credit[: p.T, :] r = r.reshape(p.T, 1) else: if method == "SS": tau_b = p.tau_b[-1, m] + tau_b_m1 = tau_b delta_tau = p.delta_tau[-1, m] + delta_tau_m1 = delta_tau tau_inv = p.inv_tax_credit[-1, m] + tau_inv_m1 = tau_inv else: tau_b = p.tau_b[: p.T, m] delta_tau = p.delta_tau[: p.T, m] tau_inv = p.inv_tax_credit[: p.T, m] r = r.reshape(p.T) - cost_of_capital = (r + p.delta - tau_b * delta_tau - tau_inv * p.delta) / ( - 1 - tau_b - ) + # cost_of_capital = (r + p.delta - tau_b * delta_tau - tau_inv * p.delta) / ( + # 1 - tau_b + # ) + dPsidKp1_t = adj_cost_dKp1(Km1, K, p, method) + dPsidK_t = adj_cost_dK(K, Kp1, p, method) + cost_of_capital = ( + (1 + r) + * ( + ((1 - tau_b_m1) * dPsidKp1_t) + + 1 + - tau_inv_m1 + - tau_b_m1 * delta_tau_m1 * (1 - tau_inv_m1) + ) + - 1 + + p.delta + - tau_b + * delta_tau + * ( + (1 - tau_inv_m1) * (1 - delta_tau_m1) + - (1 - p.delta) * (1 - tau_inv) + ) + + tau_inv * (1 - p.delta) + ) / (1 - tau_b) + dPsidK_t return cost_of_capital -def get_pm(w, Y_vec, L_vec, p, method): +# def get_pm(w, Y_vec, L_vec, p, method): +# r""" +# Find prices for outputs from each industry. + +# .. math:: +# 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}} + +# Args: +# 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: +# p_m (array_like): output prices for each industry +# """ +# if method == "SS": +# Y = Y_vec.reshape(1, p.M) +# L = L_vec.reshape(1, p.M) +# T = 1 +# else: +# Y = Y_vec.reshape((p.T, p.M)) +# L = L_vec.reshape((p.T, p.M)) +# T = p.T +# p_m = np.zeros((T, p.M)) +# for m in range(p.M): # TODO: try to get rid of this loop +# MPL = get_MPx( +# Y[:, m], L[:, m], 1 - p.gamma[m] - p.gamma_g[m], p, method, m +# ).reshape(T) +# p_m[:, m] = w / MPL +# if method == "SS": +# p_m = p_m.reshape(p.M) +# return p_m + + +def get_pm(w, Y_vec, K_vec, Kp1_vec, Km1_vec, p, method): r""" Find prices for outputs from each industry. .. math:: - 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}} + p_{m,t}=\frac{\left(\frac{\left(1+r_{t}\right)\left((1-\tau^{b}_{m,t-1})\frac{\partial \psi(K_{m,t}, K_{m,t-1})}{\partial K_{m,t}} + 1 - \tau^{inv}_{m,t-1}-\tau^{b}_{m,t-1}\delta^{\tau}_{m,t-1}(1-\tau^{inv}_{m,t})\right)-1 + \delta_m - \tau^{b}_{m,t}\delta^{\tau}_{m,t}\left((1-\tau^{inv}_{m,t-1})(1-\delta^{\tau}_{m,t-1})-(1-\delta_m)(1-\tau^{inv}_{m,t})\right) + \tau^{inv}_{m,t}(1-\delta_m)}{(1-\tau_{m,t}^{b})} \right) + \frac{\partial \psi(K_{m,t+1},K_{m,t})}{\partial K_{m,t}}}{Z_{m,t}^{\frac{\varepsilon_m-1}{\varepsilon_m}}\left(\gamma_m \frac{Y_{m,t}}{K_{m,t}}\right)^{\frac{1}{\varepsilon_m}}} Args: w (array_like): the wage rate Y_vec (array_like): output for each industry - L_vec (array_like): labor demand for each industry + K_vec (array_like): capital demand for each industry + K_vec (array_like): capital demand for each industry one period ahead + K_vec (array_like): capital demand for each industry one period prior p (OG-Core Specifications object): model parameters method (str): adjusts calculation dimensions based on 'SS' or 'TPI' @@ -550,18 +615,23 @@ def get_pm(w, Y_vec, L_vec, p, method): """ if method == "SS": Y = Y_vec.reshape(1, p.M) - L = L_vec.reshape(1, p.M) + K = K_vec.reshape(1, p.M) + Kp1 = Kp1_vec.reshape(1, p.M) + Km1 = Km1_vec.reshape(1, p.M) T = 1 else: Y = Y_vec.reshape((p.T, p.M)) - L = L_vec.reshape((p.T, p.M)) + K = K_vec.reshape((p.T, p.M)) + Kp1 = Kp1_vec.reshape((p.T, p.M)) + Km1 = Km1_vec.reshape((p.T, p.M)) T = p.T p_m = np.zeros((T, p.M)) for m in range(p.M): # TODO: try to get rid of this loop - MPL = get_MPx( - Y[:, m], L[:, m], 1 - p.gamma[m] - p.gamma_g[m], p, method, m + MPK = get_MPx( + Y[:, m], K[:, m], 1 - p.gamma[m] - p.gamma_g[m], p, method, m ).reshape(T) - p_m[:, m] = w / MPL + get_cost_of_capital = get_cost_of_capital(r, p, method, m) + p_m[:, m] = cost_of_capital / MPK if method == "SS": p_m = p_m.reshape(p.M) return p_m @@ -613,7 +683,7 @@ def get_KY_ratio(r, p_m, p, method, m=-1): def solve_L(Y, K, K_g, p, method, m=-1): r""" - Solve for labor supply from the production function + Solve for labor demand from the production function .. math:: \hat{L}_{m,t} = \left(\frac{\left(\frac{\hat{Y}_{m,t}} @@ -635,7 +705,7 @@ def solve_L(Y, K, K_g, p, method, m=-1): compute L for all industries) Returns: - L (array_like): labor demand each industry + L (array_like): labor demand for each industry """ gamma = p.gamma[m] @@ -670,7 +740,7 @@ def solve_L(Y, K, K_g, p, method, m=-1): def adj_cost(K, Kp1, p, method): r""" - Firm capital adjstment costs + Firm capital adjustment costs ..math:: \Psi(K_{t}, K_{t+1}) = \frac{\psi}{2}\biggr(\frac{\biggr(\frac{I_{t}}{K_{t}}-\mu\biggl)^{2}}{\frac{I_{t}}{K_{t}}}\biggl) @@ -693,3 +763,237 @@ def adj_cost(K, Kp1, p, method): Psi = ((p.psi / 2) * (Inv / K - p.mu) ** 2) / (Inv / K) return Psi + + +def adj_cost_dK(K, Kp1, p, method): + r""" + The derivative of firm capital adjustment costs with respect to the + capital stock. + + ..math:: + \frac{\partial \Psi(I_{m,t},K_{m,t})}{\partial K_{m,t}} = \frac{-\psi}{2}\left(\frac{K_{m,t+1}}{I^2_{m,t}}\right)\left(\frac{I_{m,t}}{K_{m,t}}-\mu\right)\left(\frac{I_{m,t}}{K_{m,t}}+\mu\right) \forall m,t + + Args: + K (array-like): Current period capital stock + Kp1 (array-like): One-period ahead capital stock + p (OG-USA Parameters class object): Model parameters + method (str): 'SS' or 'TPI' + + Returns + dPsi (array-like): The derivative of capital adjustment costs + """ + if method == "SS": + ac_method = "total_ss" + else: + ac_method = "total_tpi" + Inv = aggr.get_I(None, Kp1, K, p, ac_method) + + dPsi = ( + (-1 * p.psi / 2) * (Kp1 / Inv**2) * (Inv / K - p.mu) * (Inv / K + p.mu) + ) + + return dPsi + + +def adj_cost_dKp1(K, Kp1, p, method): + r""" + The derivative of firm capital adjustment costs with respect to next + periods capital stock. + + ..math:: + \frac{\partial \Psi(I_{m,t},K_{m,t})}{\partial K_{m,t+1}} = \frac{\psi}{2}\frac{\left(\frac{I_{m,t}}{K_{m,t}}- \mu_{m}\right)}{I_{t}}\left[1 -\mu\frac{K_{m,t}}{I_{m,t}}\right] \forall m,t + + Args: + K (array-like): Current period capital stock + Kp1 (array-like): One-period ahead capital stock + p (OG-USA Parameters class object): Model parameters + method (str): 'SS' or 'TPI' + + Returns + dPsi (array-like): The derivative of capital adjustment costs + """ + if method == "SS": + ac_method = "total_ss" + else: + ac_method = "total_tpi" + Inv = aggr.get_I(None, Kp1, K, p, ac_method) + + dPsi = (p.psi / 2) * ((Inv / K - p.mu) / Inv) * (1 - p.mu * (K / Inv)) + + return dPsi + + +def profits(r, w, K, L, Y, K_tau, p_m, p, method, m=-1): + """ + Accounting profits for the firm. + + ..math:: + \pi_{m,t} = (1 - tau_b) * \left(p_{m,t}Y_{m,t} - w_{t}L_{m,t} - + \Psi(I_{m,t},K_{m,t})\right) - I_{m,t} + + \tau^b_{m,t}\delta^{\tau}_{m,t}K^{\tau}_{m,t} + + \tau^{inv}_{m,t}I_{m,t} \forall m,t + + Args: + + Returns: + profits (array-like): Per period profits of the firm + """ + if m is None: + if method == "SS": + tau_b = p.tau_b[-1, :] + tau_b_m1 = tau_b + delta_tau = p.delta_tau[-1, :] + delta_tau_m1 = delta_tau + tau_inv = p.inv_tax_credit[-1, :] + tau_inv_m1 = tau_inv + else: + tau_b = p.tau_b[: p.T, :] + # tau_b_m1 = p.tau_b[: p.T - 1, :] Append what to the front of this?? + delta_tau = p.delta_tau[: p.T, :] + tau_inv = p.inv_tax_credit[: p.T, :] + r = r.reshape(p.T, 1) + else: + if method == "SS": + tau_b = p.tau_b[-1, m] + tau_b_m1 = tau_b + delta_tau = p.delta_tau[-1, m] + delta_tau_m1 = delta_tau + tau_inv = p.inv_tax_credit[-1, m] + tau_inv_m1 = tau_inv + else: + tau_b = p.tau_b[: p.T, m] + delta_tau = p.delta_tau[: p.T, m] + tau_inv = p.inv_tax_credit[: p.T, m] + r = r.reshape(p.T) + if method == "SS": + ac_method = "total_ss" + else: + ac_method = "total_tpi" + Psi = adj_cost(K, K, p, method) + Inv = aggr.get_I(None, Kp1, K, p, ac_method) + profits = ( + (1 - tau_b) * (p_m * Y - w * L - Psi) + - Inv + + tau_b * delta_tau * K_tau + + tau_inv * Inv + ) + + return profits + + +def get_YL_from_w(w, p_m, p, method, m=-1): + r""" + Solve for the output-labor ratio given the wage rate w and output + prices p_m. + + .. math:: + \frac{K}{L} = Z_{m,t}^{\varepsilon_m - 1}\left(\frac{1-\gamma_m-\gamma+{g,m}}{p_{m,t}w_{t}}\right) + + Args: + w (array_like): the wage rate + 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): production industry index + + Returns: + YLratio (array_like): the capital-labor ratio + + """ + if method == "SS": + Z = p.Z[-1, m] + else: + Z = p.Z[: p.T, m] + YLratio = Z ** (p.epsilon[m] - 1) * ( + (1 - p.gamma[m] - p.gamma_g[m]) / (p_m[m] * w) + ) + + return YLratio + + +def solve_K(Y, L, K_g, p, method, m=-1): + r""" + Solve for capital demand from the production function + + .. math:: + \hat{K}_{m,t} = \left(\frac{\left(\frac{\hat{Y}_{m,t}} + {Z_{m,t}}\right)^{\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}}\hat{L}_{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}} + + Args: + Y (array_like): output for each industry + L (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: + K (array_like): capital demand each industry + + """ + gamma = p.gamma[m] + gamma_g = p.gamma_g[m] + epsilon = p.epsilon[m] + if method == "SS": + Z = p.Z[-1, m] + else: + Z = p.Z[: p.T, m] + try: + if K_g == 0: + K_g = 1.0 + gamma_g = 0 + except: + if np.any(K_g == 0): + K_g[K_g == 0] = 1.0 + gamma_g = 0 + if epsilon == 1.0: + K = (Y / (Z * K_g**gamma_g * L ** (1 - gamma - gamma_g))) ** ( + 1 / gamma + ) + else: + K = ( + ( + (Y / Z) ** ((epsilon - 1) / epsilon) + - gamma_g ** (1 / epsilon) * K_g ** ((epsilon - 1) / epsilon) + - (1 - gamma - gamma_g) ** (1 / epsilon) + * L ** ((epsilon - 1) / epsilon) + ) + / (gamma ** (1 / epsilon)) + ) ** (epsilon / (epsilon - 1)) + + return K + + +def FOC_K(): + """ + The firm's FOC for it's choice of capital stock. Equibrium implies + equivalence between the interest rate and the after tax rate of return + on a unit of investment. + + .. math:: + r_{t+1} = \frac{(1 - \tau^{corp}_{m,t+1})\left(p_{m,t+1} + (Z_{m,t+1})^\frac{\varepsilon_m-1}{\varepsilon_m} + \left[\gamma_m\frac{\hat{Y}_{m,t+1}}{\hat{K}_{m,t+1}} + \right]^\frac{1}{\varepsilon_m} - \frac{\partial + \Psi(\hat{I}_{m,t+1},\hat{K}_{m,t+1})}{\partial + \hat{K}_{m,t+1}}\right) + 1 - \delta_{m} + + \tau^{corp}_{m,t+1}\delta^\tau_{m,t+1}\left[(1- + \tau^{inv}_{m,t})(1-\delta^\tau_{m,t})-(1-\delta_m)(1- + \tau^{inv}_{m,t+1})\right] - \tau^{inv}_{m,t+1}(1-\delta_{m})} + {(1-\tau^{corp}_{m,t})\frac{\partial + \Psi(\hat{I}_{m,t},\hat{K}_{m,t})}{\partial \hat{K}_{m,t+1}}+1 + -\tau^{inv}_{m,t}-\tau^{corp}_{m,t}\delta^{\tau}_{m,t}(1 + -\tau^{inv}_{m,t})} - 1 \quad\forall m,t + + Args: + + Returns: + """ \ No newline at end of file diff --git a/tests/test_firm.py b/tests/test_firm.py index a3693e2ad..857b346fd 100644 --- a/tests/test_firm.py +++ b/tests/test_firm.py @@ -1,4 +1,3 @@ -from math import exp import pytest from ogcore import firm import numpy as np @@ -1008,8 +1007,8 @@ def test_solve_L(Y, K, Kg, p, method, expected): K_2 = 6 Kp1_2 = 6 expected_Psi_2 = 0.011527985 -expected_dPsidK_2 = -0.122196836 -expected_dPsidKp1_2 = 0.102296044 +expected_dPsidK_2 = -0.102296044 +expected_dPsidKp1_2 = 0.023880951 p3 = Specifications() @@ -1023,8 +1022,8 @@ def test_solve_L(Y, K, Kg, p, method, expected): K_3 = np.array([4, 4.5, 5.5]) Kp1_3 = np.array([4.5, 5.5, 5]) expected_Psi_3 = np.array([0.309124823, 0.534408906, -1.520508524]) -expected_dPsidK_3 = np.array([-0.805820108, -0.846107505, 2.657143029]) -expected_dPsidKp1_3 = np.array([0.479061039, 0.43588367, -62.31580895]) +expected_dPsidK_3 = np.array([-0.538943669, -0.532746708, 56.65073541]) +expected_dPsidKp1_3 = np.array([0.316298002, 0.329639281, 72.59138531]) @pytest.mark.parametrize( @@ -1042,3 +1041,37 @@ def test_adj_cost(K, Kp1, p, method, expected): """ test_val = firm.adj_cost(K, Kp1, p, method) assert np.allclose(test_val, expected) + + +@pytest.mark.parametrize( + "K,Kp1,p,method,expected", + [ + (K_1, Kp1_1, p1, "SS", expected_dPsidK_1), + (K_2, Kp1_2, p2, "SS", expected_dPsidK_2), + (K_3, Kp1_3, p3, "TPI", expected_dPsidK_3), + ], + ids=["Zero cost", "Non-zero cost", "TPI"], +) +def test_adj_cost_dK(K, Kp1, p, method, expected): + """ + Test of the firm capital adjustment cost function. + """ + test_val = firm.adj_cost_dK(K, Kp1, p, method) + assert np.allclose(test_val, expected) + + +@pytest.mark.parametrize( + "K,Kp1,p,method,expected", + [ + (K_1, Kp1_1, p1, "SS", expected_dPsidKp1_1), + (K_2, Kp1_2, p2, "SS", expected_dPsidKp1_2), + (K_3, Kp1_3, p3, "TPI", expected_dPsidKp1_3), + ], + ids=["Zero cost", "Non-zero cost", "TPI"], +) +def test_adj_cost_dKp1(K, Kp1, p, method, expected): + """ + Test of the firm capital adjustment cost function. + """ + test_val = firm.adj_cost_dKp1(K, Kp1, p, method) + assert np.allclose(test_val, expected)