Python ⇄ Julia bridge for the OptimalGIV package
Project description
optimalgiv
A minimal Python wrapper for OptimalGIV.jl
This interface enables Python users to call Granular Instrumental Variables (GIV) estimators directly on pandas DataFrames using JuliaCall. Julia is automatically installed and all dependencies are resolved without manual setup.
Installation
pip install optimalgiv
On first use, optimalgiv will automatically:
- Install Julia (if not already available)
- Install
OptimalGIV.jland supporting packages - Precompile and create a self-contained Julia environment
Quickstart
import pandas as pd
import numpy as np
from optimalgiv import giv
df = pd.DataFrame({
"id": np.repeat([1, 2], 5),
"t": list(range(1, 6)) * 2,
"q": np.random.randn(10),
"p": np.random.randn(10),
"η1": np.random.randn(10),
"η2": np.random.randn(10),
"absS": np.abs(np.random.randn(10)),
})
model = giv(
df,
"q + endog(p) ~ id & (η1 + η2)",
id="id", t="t", weight="absS",
algorithm="scalar_search",
guess={"Aggregate": 2.0}
)
print(model.coef)
print(model.coefficient_table())
References
-
Gabaix, Xavier, and Ralph S.J. Koijen.
Granular Instrumental Variables.
Journal of Political Economy, 132(7), 2024, pp. 2274–2303. -
Chaudhary, Manav, Zhiyu Fu, and Haonan Zhou.
Anatomy of the Treasury Market: Who Moves Yields?
Available at SSRN: https://ssrn.com/abstract=5021055
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file optimalgiv-0.1.9.tar.gz.
File metadata
- Download URL: optimalgiv-0.1.9.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c38b0e5b42a4cb0e3d308dcd547cff9278f5542943f004b8c7073f1a39a5ce2d
|
|
| MD5 |
27ed0677357aaf67821fa7ee38c241f5
|
|
| BLAKE2b-256 |
981708db64eae9edc603bb0eed4be6106e04921d61178ccd3fc26c8548b3cbf4
|
File details
Details for the file optimalgiv-0.1.9-py3-none-any.whl.
File metadata
- Download URL: optimalgiv-0.1.9-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5d3f3e434e50244bbaa274cfcf6292973bf3a913f521c4cb5b47d799933c0f0
|
|
| MD5 |
ff5a5a85d0f6edac6df1930d827bb9a0
|
|
| BLAKE2b-256 |
756fef38c03252df83661c2ab94fba8298d570c85e0cecddc12c5a1d8ee7384d
|