Skip to main content

Python ⇄ Julia bridge for the OptimalGIV package

Project description

optimalgiv

A minimal Python wrapper for OptimalGIV.jl, a Julia package developed by Zhiyu Fu for estimating Generalized Instrumental Variable (GIV) models.

This interface enables Python users to call 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.jl and 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())

Credits

This package wraps the core functionality of OptimalGIV.jl, authored by Zhiyu Fu. All modeling logic and algorithms originate from her original Julia implementation.


License

MIT License

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

optimalgiv-0.1.8.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

optimalgiv-0.1.8-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file optimalgiv-0.1.8.tar.gz.

File metadata

  • Download URL: optimalgiv-0.1.8.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for optimalgiv-0.1.8.tar.gz
Algorithm Hash digest
SHA256 764947b502ab4938a5e397068a7b1b97191dad44da8d416d8bd1cd75cb2fa43f
MD5 147d8fbfc6ba302599274caf59cef808
BLAKE2b-256 dc34a0cd84f90b94d5c2893814187e8dc0d19070be68db12c7a748136f6c6e53

See more details on using hashes here.

File details

Details for the file optimalgiv-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: optimalgiv-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for optimalgiv-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 23b9d75098be11cdcf4c542ccc74c0b0c5b9b99dfcce46a788936a782d970867
MD5 c73aeea4020d4889c0218c2431413811
BLAKE2b-256 be2e7e2f8f23165275a73a428502e479f238b9b49c3ed8ac1d4ef0fd8dfa33e0

See more details on using hashes here.

Supported by

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