Skip to main content

A python package for assessing local determinacy in incomplete markets models.

Project description

Local Determinacy (LD)

A python package for assessing local determinacy in incomplete markets models. The theoretical framework framework is based on the working paper Local Determinacy in Incomplete-Markets Models, 2023 (Marcus Hagedorn).

Methodology

  • The first step in Hagedorn (23) is constructing the linearized version, ignoring exogenous shocks which are irrelevant for determinacy, of the incomplete-markets model
\sum_{k=-j}^{\infty} M_k x_{t-k} = 0,

for a Period $t$ vector $x_t$ of endogenous variables and square matrices $(M_k)_{k=-j}^{\infty}$ describing equilibrium conditions.

  • In a simple incomplete-markets model the asset market clearing condition, $A(\pi_{t-1},\pi_t, \pi_{t+1}, \ldots, \pi_{t+k}, \ldots) - B = 0$ constitutes the only equilibrium condition. The linearized version of the asset market clearing condition
		\sum_{k=-1}^{\infty} A_k E_t \pi_{t+k} = 0,

where inflation $\pi$ is the only endogenous variable

  • The SSJ package delivers the derivatives of the asset market clearing condition, $A(\pi_{t-1},\pi_t, \pi_{t+1}, \ldots, \pi_{t+k}, \ldots) - B = 0$,
		A_k = \frac{\partial (A(\ldots) - B)}{\partial x_{t+k}} =  \frac{\partial (A(\ldots) - B)}{\partial \pi_{t-1+k}}, \text{ \hspace{0.2cm} where \hspace{0.1cm} $x_{t+k} = \pi_{t+k-1} \hspace{0.1cm}$, for \hspace{0.2cm}} k=-1,0,1,2,\ldots
  • Onatski (06) defines the complex function
			{\Theta(\lambda)} = det \sum_{k=-j}^{\infty} A_k e^{-i k \lambda},
  • The Winding number is defined as the number of times the graph of $\Theta(\lambda)$ rotates around zero counter-clockwise when $\lambda$ goes form $0$ to $2 \pi$.

  • Ontaski (2006) shows

    • Determinacy (=unique bounded solution) if the winding number of $\Theta(\lambda)$ is equal to zero.

    • Multiple Solutions if winding number is less than zero.

    • No Solution if winding number is larger than zero.

Requirements and installation

LD runs on Python 3.7 or newer, and requires Python's core numerical libraries (NumPy, SciPy, Numba).

LD uses the methodology developed in Auclert, Bardóczy, Rognlie, Straub (2021): "Using the Sequence-Space Jacobian to Solve and Estimate Heterogeneous-Agent Models" (link to paper) to obtain the Jacobian matrix of the incomplete-markets model.

LD uses the SSJ package of Bence Bardóczy, Michael Cai, Matthew Rognlie, Adrien Auclert, Martin Souchier and Ludwig Straub. The latest version is available at https://github.com/shade-econ/sequence-jacobian.

To install LD, open a terminal and type:

pip install local_determinacy

To install the required packages run the following from the package root directory:

pip install -r requirements.txt

Functions

The LD package has four main functions:

  1. The onatski values of a jacobian
>>> onatski(targets, endogenous, scale, T, ss0, H_U)
#Returns a vector of Onatski function outputs
  1. The winding number of a onatski function
>>> onatskiWindingNumber(onatski)
#Returns the winding number of a given sequence of Onatski function outputs
  1. An assessment of local-determinacy
>>> checkSolutions(windingNumber)
#Returns a string assessment of local-determinacy
  1. A plot of the Onatski function
>>> plot(Onatski)
#Returns a plot of the Onatski function in the complex space

Usage

The LD package handles a variety of incomplete markets models. Please see the provided Jupyter notebooks for examples. Given the jacobian $H_U$ of a model, in which the asset market clering condition is the only equilibrium condition and lagged inflation $piL$ is the only endogenous vaiable. LD assesses local determinacy in a simple incomplete markets model as follows:

import local_determinacy as ld

T = 300   

unknowns = ['piL']
targets = ['asset_mkt']

H_U = ha.jacobian(ss, unknowns, targets, T=T)

onatski = ld.onatski(targets = targets, endogenous = unknowns, T = T, ss0 = ss0, H_U = H_U)

windingNumber = ld.onatskiWindingNumber(onatski)

windingNumber = ld.onatskiWindingNumber(onatski)
print(ld.checkSolutions(windingNumber))

ld.plot(onatski)

If government bonds are nominal, an addtional elasticity decscibing valuation effects needs to be added. The default setting assumes that all variables (for example lagged inflation) are predetermined. In general, LD requires specifying lagged/predetermined variables. The notebook examples illustrate these options.

Authors

This package was written by

  • Marcus Hagedorn
  • Alfred Løvgren

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

local_determinacy-0.1.5.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

local_determinacy-0.1.5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file local_determinacy-0.1.5.tar.gz.

File metadata

  • Download URL: local_determinacy-0.1.5.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for local_determinacy-0.1.5.tar.gz
Algorithm Hash digest
SHA256 59dc986b150e7a4318e33e438b01a8e4ffc1df2fbc45b93403f8855745430bc8
MD5 9d3c6beeeed9e52ae53de072e6efbe21
BLAKE2b-256 f50eb1a375b14466ee371801df8772762f5ec467ebb2892ac5acc5d17f3a08e7

See more details on using hashes here.

File details

Details for the file local_determinacy-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for local_determinacy-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 baabac5d8a672d577b7535310fbe9f2aa30226d101ad92bfde3a5d5a15ca1796
MD5 db95b00a39c46f6b8de0a4e325f845fd
BLAKE2b-256 651c3caf81546451f7e160d29540f32cc2c66e65e2713241f179c4bcfee941ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page