Skip to main content

Inferential tools for network-dependent data.

Project description

networkinference is a Python 3 package implementing econometric methods for inference with data exhibiting network dependence or other forms of complex or unknown weak dependence. The package is developed by Michael P. Leung and distributed under the 3-Clause BSD license. Much of the package is based on work supported by NSF grant SES-1755100.

Installation

Install via command line using pip3, which is included with Python 3.4+:

$ pip3 install networkinference

Overview

The package contains three main classes:

  • OLS: OLS estimator.

  • TSLS: 2SLS estimator.

  • IPW: Horovitz-Thompson estimator (inverse-probability weighting estimator with known propensity scores).

Each class contains five methods for constructing confidence intervals and two methods implementing scalar equality tests. These methods are based on three classes of inference procedures. The first uses a network HAC variance estimator [1] [2]. The second constructs network clusters using spectral clustering and applies a cluster-robust inference method [4]. Both require network data and account for a general form of network dependence in which observations are less correlated when further apart in the network (in the sense of shortest path distance) [1]. The third involves resampling and can be applied to weakly dependent network, clustered, time series, or spatial data (or combination or these) without knowledge of the particular type of dependence [3] [5]. However, it is more computationally intensive and requires a larger amount of data to ensure adequate size control and power.

The methods are also available as independent functions through the core class for use with custom estimators.

The core class and utils subpackage contain various utilities for computing summary statistics, plotting the spectrum of the Laplacian, constructing friends-of-friends instruments for estimating linear-in-means models, and simulating data.

Example Usage

>>> import networkinference as ni               # main package
>>> from networkinference.utils import FakeData # utilities for generating fake data
>>> Y, X, W, A = FakeData.tsls()                # simulate data from linear-in-means model
>>> tsls = ni.TSLS(Y, X, W, A)                  # load data into tsls object
>>> tsls.network_se()                           # print estimates with network-robust SEs
>>> help(tsls)                                  # displays documentation for tsls object

References

Dependencies

  • Matplotlib v3.4+

  • NetworkX v2.6+

  • NumPy v1.21+

  • Scikit-learn v0.24+

  • SciPy v1.7+

  • Seaborn v0.11+

  • Tabulate v0.8+

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

networkinference-0.0.2.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

networkinference-0.0.2-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file networkinference-0.0.2.tar.gz.

File metadata

  • Download URL: networkinference-0.0.2.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for networkinference-0.0.2.tar.gz
Algorithm Hash digest
SHA256 6b4b636e9862d9d0e0d103e3b7f96bf096773dac67ae64f29b8bf4882f964d9f
MD5 509aae7cd8d5540ddc27c840610ba5d9
BLAKE2b-256 4a60b1daacbe93022ca0521d1164ef7883b0c2ef6f2031ad40307bbe76769fad

See more details on using hashes here.

File details

Details for the file networkinference-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: networkinference-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for networkinference-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 63e6e6cbd5eceef205de2c8f5c8c30eff4d13751cc4819a0ec2705bac6b11c00
MD5 0c6517f2bb03e53e0650d9baaaa70004
BLAKE2b-256 e48f37e406eb7b61d16568db2966883b2e1c2529f8d0aa9e0565ab20ef282b1c

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