Skip to main content

Python bindings for gretl

Project description

                _   _   ___
               | | | | /   |
  __ _ _ __ ___| |_| |/ /| |_ __  _   _
 / _` | '__/ _ \ __| / /_| | '_ \| | | |
| (_| | | |  __/ |_| \___  | |_) | |_| |
 \__, |_|  \___|\__|_|   |_/ .__/ \__, |
  __/ |                    | |     __/ |
 |___/                     |_|    |___/

gretl4py: Python Bindings for gretl

Python bindings for the gretl econometrics library

gretl4py provides Python bindings to gretl, a free, open-source, cross-platform software package for econometric analysis. Gretl is known for its numerical accuracy and computational efficiency — capabilities that gretl4py inherits directly through the underlying libgretl engine.

Windows users: This package requires the Visual C++ 2022 Redistributable x64. Please install it from: https://aka.ms/vs/17/release/vc_redist.x64.exe

gretl4py is not a standalone econometrics library. Instead, it serves as a bridge between Python and libgretl, exposing a high-performance backend that supports:

  1. Econometric estimation: least squares, maximum likelihood, GMM; single-equation and system estimators; regularized regression (LASSO, Ridge, Elastic Net)
  2. Time-series methods: ARIMA, numerous univariate GARCH-type models, VARs and VECMs (including structural VARs), unit-root/cointegration tests, Kalman filter, etc.
  3. Limited dependent variables: logit, probit, tobit, sample selection, interval regression, count and duration models, etc.
  4. Panel-data estimators: including IV, probit, and GMM-based dynamic panel methods
  5. Mixed-frequency (MIDAS) models
  6. Machine learning support via LIBSVM
  7. The hansl scripting language, enabling users to write gretl function packages — collections of hansl-written functions for advanced econometric analysis https://gretl.sourceforge.net/function_packages.html

Please note that some features available in gretl (e.g., Kalman filtering) are not yet implemented in gretl4py, but are planned. For full documentation, visit the gretl4py project page: https://gretl.sourceforge.net/gretl4py.html

Note The official PDF documentation is under development and still requires updates. Example scripts are available in the demo/ directory: https://sourceforge.net/p/gretl/gretl4py/ci/v0.2/tree/demo/


Package Contents

  1. libgretl (including plugins) and its dependencies
  2. The gretl4py binary module providing the Python–C interface
  3. Additional Python helper modules
  4. Example scripts in examples/
  5. Sample datasets in data/

Provided Functionality

Available Estimators

:: ar, ar1, arima, biprobit, dpanel, duration, garch, heckit, hsk, intreg, lad, logit, logistic, midasreg, mpols, negbin, ols, panel, poisson, probit, quantreg, tobit, tsls, wls, var, vecm

Available Tests

:: add, adf, arch, autocorr, bds, bkw, breusch-pagan, chow, coeffsum, coint, comfac, cusum, difftest, johansen, kpss, leverage, levinlin, logs, meantest, normality, normtest, omit, panel, panspec, qlrtest, reset, restrict, runs, squares, white, white-nocross, vartest, vif, xdepend

Note Some tests operate on datasets, while others are model-based.


Usage

1. Loading Datasets

Supported formats: .gdt, .gdtb, .csv, .dta, .wf1, .xls, .xlsx, .ods

Use get_data() to load a dataset:

import importlib.resources as resources
import gretl

data_dir = resources.files('gretl').joinpath('data')
d1 = gretl.get_data(str(data_dir.joinpath('bjg.gdt')))

Bundled Datasets:

:: abdata.gdt, bjg.gdt, data9-7.gdt, greene19_1.gdt, grunfeld.gdt, mroz87.gdt, rac3d.gdt, b-g.gdt, data4-10.gdt, denmark.gdt, greene22_2.gdt, kennan.gdt, ooballot.gdt, tobit.gdt, bjg.csv, data4-1.gdt, gdp_midas.gdt, greene25_1.gdt, longley.csv, penngrow.gdt, wtp.gdt

  1. Estimating Models

Basic usage pattern:

m = gretl.ESTIMATOR()
m.fit()

where ESTIMATOR() is any supported estimator. To use a specific dataset, supply it via data=... keyword argument.

Examples

Example scripts are located in examples/estimators/ and include:

:: ar1.py, biprobit.py, heckit.py, logit.py, ols.py, probit.py, wls.py, arima.py, duration.py, lad.py, mpols.py, panel.py, tobit.py, ar.py, garch.py, logistic.py, negbin.py, poisson.py, quantreg.py, tsls.py

Example: OLS Regression

To view the source of ols.py

import inspect
import gretl.examples.estimators.ols

print(inspect.getsource(gretl.examples.estimators.ols.run_example))

To run the example:

import gretl.examples.estimators.ols
gretl.examples.estimators.ols.run_example()

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

gretl4py-0.50.tar.gz (11.2 MB view details)

Uploaded Source

Built Distributions

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

gretl4py-0.50-cp314-cp314-win_arm64.whl (45.8 MB view details)

Uploaded CPython 3.14Windows ARM64

gretl4py-0.50-cp314-cp314-win_amd64.whl (60.7 MB view details)

Uploaded CPython 3.14Windows x86-64

gretl4py-0.50-cp314-cp314-manylinux_2_39_aarch64.whl (56.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ ARM64

gretl4py-0.50-cp314-cp314-manylinux_2_28_x86_64.whl (40.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

gretl4py-0.50-cp314-cp314-macosx_10_15_universal2.whl (34.8 MB view details)

Uploaded CPython 3.14macOS 10.15+ universal2 (ARM64, x86-64)

gretl4py-0.50-cp313-cp313-win_arm64.whl (44.5 MB view details)

Uploaded CPython 3.13Windows ARM64

gretl4py-0.50-cp313-cp313-win_amd64.whl (59.3 MB view details)

Uploaded CPython 3.13Windows x86-64

gretl4py-0.50-cp313-cp313-manylinux_2_39_aarch64.whl (56.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ ARM64

gretl4py-0.50-cp313-cp313-manylinux_2_28_x86_64.whl (40.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

gretl4py-0.50-cp313-cp313-macosx_10_15_universal2.whl (34.8 MB view details)

Uploaded CPython 3.13macOS 10.15+ universal2 (ARM64, x86-64)

gretl4py-0.50-cp312-cp312-win_arm64.whl (44.5 MB view details)

Uploaded CPython 3.12Windows ARM64

gretl4py-0.50-cp312-cp312-win_amd64.whl (59.3 MB view details)

Uploaded CPython 3.12Windows x86-64

gretl4py-0.50-cp312-cp312-manylinux_2_39_aarch64.whl (56.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ ARM64

gretl4py-0.50-cp312-cp312-manylinux_2_28_x86_64.whl (40.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

gretl4py-0.50-cp312-cp312-macosx_10_15_universal2.whl (34.8 MB view details)

Uploaded CPython 3.12macOS 10.15+ universal2 (ARM64, x86-64)

gretl4py-0.50-cp311-cp311-win_arm64.whl (44.5 MB view details)

Uploaded CPython 3.11Windows ARM64

gretl4py-0.50-cp311-cp311-win_amd64.whl (59.3 MB view details)

Uploaded CPython 3.11Windows x86-64

gretl4py-0.50-cp311-cp311-manylinux_2_39_aarch64.whl (56.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ ARM64

gretl4py-0.50-cp311-cp311-manylinux_2_28_x86_64.whl (40.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

gretl4py-0.50-cp311-cp311-macosx_10_15_universal2.whl (34.8 MB view details)

Uploaded CPython 3.11macOS 10.15+ universal2 (ARM64, x86-64)

File details

Details for the file gretl4py-0.50.tar.gz.

File metadata

  • Download URL: gretl4py-0.50.tar.gz
  • Upload date:
  • Size: 11.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for gretl4py-0.50.tar.gz
Algorithm Hash digest
SHA256 137a34c94e971a2293c38a2bb4c31f2da402f321999110d8c1a00f159af7ec1e
MD5 cacfe3d393c2f3c32af7abcca544b8b2
BLAKE2b-256 0853018b0758f25da85c483341b46b10333743ce6730c5be2e45c6bbef13049e

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp314-cp314-win_arm64.whl.

File metadata

  • Download URL: gretl4py-0.50-cp314-cp314-win_arm64.whl
  • Upload date:
  • Size: 45.8 MB
  • Tags: CPython 3.14, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for gretl4py-0.50-cp314-cp314-win_arm64.whl
Algorithm Hash digest
SHA256 6311e2d8a1011ed52c2c9b1d796c7de35b5f8ad2ec00e79b2adcf2d88feb8b4f
MD5 e9c880d076abeb603df180c2dda768c8
BLAKE2b-256 311a6c235d5e5a1aa2c632041eded171fe9048bca3042b8b533f243f9eae8749

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: gretl4py-0.50-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 60.7 MB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for gretl4py-0.50-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 933c90a38ccdb2503f362bb285ae1d371af7542cd7b3769b0e6b04dfb60f634c
MD5 480e8928464b83d13bd1eb4cb42e02e4
BLAKE2b-256 d030ac25f14ad35c3565902dde7be480137d741d9a44ff3bac1e13ed6215cbe4

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp314-cp314-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp314-cp314-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 f46524b072fca5e7f89f6a0f23e7d5d43c32267ebcde582908c94348ead30a2e
MD5 200e6aac99a0f24fc6fae9c06b7c6353
BLAKE2b-256 ae311f92dff9045945d9be2a8d1299c869559cd795603c859ea1ada5dc61faa9

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a02617ef90ff27e20f204f9c58bec9ca5009888c85e904137c3f0262a8eb7bcd
MD5 cb4ecc6dc51b989108b5f760c045cb2d
BLAKE2b-256 861f4d807c4387cbb61288a0f062b4a0cc1108a96c01fd388457f6c1fbbe7a38

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp314-cp314-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 ddb9bace2a2a8c57ac372833fe8ead7491c6239ff33bc14fa2b54d0fc4940a03
MD5 4b907e66a1c0b5cd7e27944992537ab1
BLAKE2b-256 86d3e0ed90b0114fa5eb51b6bee9c862fbd737f487d0f4cb5938f1bb3e1e2805

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp313-cp313-win_arm64.whl.

File metadata

  • Download URL: gretl4py-0.50-cp313-cp313-win_arm64.whl
  • Upload date:
  • Size: 44.5 MB
  • Tags: CPython 3.13, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for gretl4py-0.50-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 0667c574c9eb446b607e9de9801391949363ccf8490bb81ba42c0bf7fe7ad2dd
MD5 8caab24d7280e9449ff3fa709d1f1ef8
BLAKE2b-256 7305fade385350cb20085bb9d1e86071e752b77b01c46c10834d1aaf6d3f5172

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: gretl4py-0.50-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 59.3 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for gretl4py-0.50-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 34288ec925f9e9eb3ed80ee8f40a72b95bf5638f9564fa285b203d1a5a870744
MD5 06e55129b92a42b2a358e1ab51fa231d
BLAKE2b-256 9e013daa7b87409fd3134fa36966a3b29476fa72fd29655512b375cf11eb0120

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp313-cp313-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp313-cp313-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 8d8c1abc84fdece3118b4aebaa5af2c47cc2d8b2543b97c88a3d6c0275f692d7
MD5 98133d0642d42fa82820338a47693ba0
BLAKE2b-256 b70101b57131fe67bf61be92e2936734787beb08f67d0b1bb4cbc664bfdb7c5c

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2fd7c6ee440e14f2e749f7969c774b36bf03caad46e3c1e9cc8fa02d8d344fae
MD5 15203f4130bed436970136843fec69ba
BLAKE2b-256 a1c2257d924624b8fddc6e1cc7e12f64c96023c5b5ec0f604875546640c5382a

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp313-cp313-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp313-cp313-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 18fcacfede3ec1f3ec0f6ecce0cb415547844ee1e3d89cef353b22ae8bc1a0fe
MD5 bbe302cfdb81fd383f511dfc00c9d3ce
BLAKE2b-256 fb41218b86439a2a928a160a24e21be65a753c9b06ebf09a24b67ed0d9022401

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp312-cp312-win_arm64.whl.

File metadata

  • Download URL: gretl4py-0.50-cp312-cp312-win_arm64.whl
  • Upload date:
  • Size: 44.5 MB
  • Tags: CPython 3.12, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for gretl4py-0.50-cp312-cp312-win_arm64.whl
Algorithm Hash digest
SHA256 b6b6e3ab3f4593a06002f48babd0020f432edc6e6c7d7e3a314d63d25b76fb26
MD5 2a5b36b61579058b571141537ed4a8b6
BLAKE2b-256 9426f409ef9aea55741766fb21f7857e979652fcd848d70070f065db28e0dac5

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: gretl4py-0.50-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 59.3 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for gretl4py-0.50-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 702c4cb677b9bacc4f38c53660919f08c2cf5201fe10240466012937b872d271
MD5 3e6718936e749081d7167605135a5036
BLAKE2b-256 ce84400578993b058b878f4d88380009cc2beeacb7039e32a920ddfe1c2059ca

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp312-cp312-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp312-cp312-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 4745d9172a42b229abf65f2af07f13a8a55359e0886fa4491617add8df44fe76
MD5 9fb39dad7a99657110d3100317a8e147
BLAKE2b-256 83f058b55c3f977e7dc23c7491e8d40d73da955fb45645e70a9c0f2c4bc056ef

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dacbb24065ac549f2182a3cca840f93c4eccd420999e28430ffceffea460b919
MD5 281189af0ef5a877743af61c63a8907d
BLAKE2b-256 1c6ac826aea9f88a204673834cb4dbb373ae7ff4eda4671bbc98f23190614613

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp312-cp312-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp312-cp312-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 bf226dd6c20c1203ae7ef07fe18bf6ab1f8d54c8e7df8bed8467f3e0c951dfcd
MD5 d034bbe368af9fb8474e33e81c373226
BLAKE2b-256 31b1ab262f15734b4f113bfac11715a1420aab1ea29ef67ede9f2c2481fbf879

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp311-cp311-win_arm64.whl.

File metadata

  • Download URL: gretl4py-0.50-cp311-cp311-win_arm64.whl
  • Upload date:
  • Size: 44.5 MB
  • Tags: CPython 3.11, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for gretl4py-0.50-cp311-cp311-win_arm64.whl
Algorithm Hash digest
SHA256 0242b64414e749ac1448f279570286603e9df9266a68d3de79cd0adca1238511
MD5 1fd53dc33a530f8040656e016fc8a5ce
BLAKE2b-256 d46d4d026e3ed8363fab34b9a634901ce17598bb2c0d8c9f8fa7bad5657e8705

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: gretl4py-0.50-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 59.3 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for gretl4py-0.50-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fd6c4ca6e0a8c30def4c183fe51d57b1517162b36f564c425bb266e68b8a21c4
MD5 d66c570adcf1153e13d1e172f2b0d2c0
BLAKE2b-256 1915b783ab8cff7b505266b732fae4f2a54d7e2d36380b627defc53af6ee369e

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp311-cp311-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp311-cp311-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 5c3ca30fd9f0b917fd5e73ad0fe6bf77e97792e45c65b03a10aca2e8f0fc9200
MD5 108c842955bb5e4b48481990fbda44dc
BLAKE2b-256 c2a7bdfb3568dce90fa5cf6d3d7e0672dac0ab5dd22fe2a0c381a93f3be23c9a

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a63efc17be2500b71a09fdd099b8166399cfa014c65a5c46f71f63beaebde5d5
MD5 f2de824029ed67c9e0a37c675271630e
BLAKE2b-256 ba107fbcf620d4d69434c9e0cde4d9a1a8f2810903457b8b0b5cf1fbd13af8d5

See more details on using hashes here.

File details

Details for the file gretl4py-0.50-cp311-cp311-macosx_10_15_universal2.whl.

File metadata

File hashes

Hashes for gretl4py-0.50-cp311-cp311-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 36f2251fc313e5f635fc05e9352d7d396008f04cd899e7fdeea1d04a5e73af86
MD5 d41fb7d0b3477188f0ff54383d961070
BLAKE2b-256 0854d77abbf4ca1bdf6734b03ad4eced738c60f231158c347e79dfd6c74fee9f

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