Skip to main content

Python bindings for gretl

Project description

gretl4py: Python Bindings for gretl

            _   _   ___
           | | | | /   |

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

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.

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.4.tar.gz (8.7 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.4-cp314-cp314-win_arm64.whl (43.4 MB view details)

Uploaded CPython 3.14Windows ARM64

gretl4py-0.4-cp314-cp314-win_amd64.whl (60.0 MB view details)

Uploaded CPython 3.14Windows x86-64

gretl4py-0.4-cp314-cp314-manylinux_2_28_x86_64.whl (38.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

gretl4py-0.4-cp314-cp314-macosx_10_15_universal2.whl (32.2 MB view details)

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

gretl4py-0.4-cp313-cp313-win_arm64.whl (42.1 MB view details)

Uploaded CPython 3.13Windows ARM64

gretl4py-0.4-cp313-cp313-win_amd64.whl (58.7 MB view details)

Uploaded CPython 3.13Windows x86-64

gretl4py-0.4-cp313-cp313-manylinux_2_28_x86_64.whl (38.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

gretl4py-0.4-cp313-cp313-macosx_10_15_universal2.whl (32.2 MB view details)

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

gretl4py-0.4-cp312-cp312-win_arm64.whl (42.1 MB view details)

Uploaded CPython 3.12Windows ARM64

gretl4py-0.4-cp312-cp312-win_amd64.whl (58.9 MB view details)

Uploaded CPython 3.12Windows x86-64

gretl4py-0.4-cp312-cp312-manylinux_2_28_x86_64.whl (38.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

gretl4py-0.4-cp312-cp312-macosx_10_15_universal2.whl (32.2 MB view details)

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

gretl4py-0.4-cp311-cp311-win_arm64.whl (42.1 MB view details)

Uploaded CPython 3.11Windows ARM64

gretl4py-0.4-cp311-cp311-win_amd64.whl (58.9 MB view details)

Uploaded CPython 3.11Windows x86-64

gretl4py-0.4-cp311-cp311-manylinux_2_28_x86_64.whl (38.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

gretl4py-0.4-cp311-cp311-macosx_10_15_universal2.whl (32.2 MB view details)

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

File details

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

File metadata

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

File hashes

Hashes for gretl4py-0.4.tar.gz
Algorithm Hash digest
SHA256 ab9dcb1978b16e2057a293b985943a4e8b8b7fe68f8f31375771a6c4e5d57af5
MD5 198c81bc57835777c7481c6c02a6d80b
BLAKE2b-256 4f4b30135620e1a51d6b6f3dfc4f77208309425945639825e3a43e8c909913a9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gretl4py-0.4-cp314-cp314-win_arm64.whl
Algorithm Hash digest
SHA256 e8625a31f48deffbb8d3ca853e9bb011a18c27fd60b2c7776be53d083b20ad26
MD5 4bf11e440d5e286607ebf930350794b9
BLAKE2b-256 db7dce52f973f8e5116b3b60496a705687be88fb8b7c1b3297159a3e6d60cc04

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gretl4py-0.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 65152092f0642ab13e18be42bf31c192bc8597721f8f21ed19aceff231e702e7
MD5 08f4e1125f7495c69fd31812520b2f1e
BLAKE2b-256 7bec5d682b70d82d23c93aebcd3a031fa4662f4afbba9c2c630fe127352cf7b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gretl4py-0.4-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2c511455f2fc4505b116a6850d50c7d5c6a486044a70ad4cd88d37841cafbb53
MD5 3cf7413382f9bd6b38a61c24bc50df87
BLAKE2b-256 c14e888aba1f820655ce8860bfb961ff21b3b1db3cb3e780551b1ca91b7f87b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gretl4py-0.4-cp314-cp314-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 adc21815c2b9d55b21676622ee3625e5db68f9db29a3568aee7c2284a61ec375
MD5 41b25de9c9e73cf94818a4ec58ec090f
BLAKE2b-256 5e8793101134bfcc7bace8ad6ca548893f96588b33d122ab56c133d67094ad62

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gretl4py-0.4-cp313-cp313-win_arm64.whl
Algorithm Hash digest
SHA256 f2c8d0665e9187b0d1670b830dc9bcad9765edc8eb0950e0e3258e584fc25356
MD5 910603d4560bc0f6fe2b6116c82a3051
BLAKE2b-256 c39462c2b8b42f559c4825184828bb5e5901e10a7662846579ade26b854b5eae

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gretl4py-0.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 01ccb9a982d732af406378ee8f786f840763d24247e2145630ffb612a4606130
MD5 24e38131af5f130141e6168c87dd0a4b
BLAKE2b-256 55022f1d1b45a482c480f14628e9565e8b6e5786c892ad9335919b56b3605c32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gretl4py-0.4-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c2369c42e7e17f46caa7554c85736d90d85b1e2263bf374164f005a0a1926638
MD5 4a78e3d58f4653ebff569291f4d4c526
BLAKE2b-256 5e65d3bc997b2f391f6782b05c08481949cf872e8027538c4ad52e0432149c6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gretl4py-0.4-cp313-cp313-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 d07ea92b12aa9ca0fa4a47a5be212aef1108dec2ec27bf5b924e023234a2ddff
MD5 88d130d02f2205ece6df148a23dc2f51
BLAKE2b-256 90221d79801aeb293b3c60005c34d70b46e92bed79348a96633e97d6a0b10f02

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gretl4py-0.4-cp312-cp312-win_arm64.whl
Algorithm Hash digest
SHA256 54d18f6f8c5ed53ea662a8d10e70cbda89b5ebcf0d00242de176b4a72e97fffe
MD5 b377222bea07df7a5a5d30223620d636
BLAKE2b-256 f16e08ce6e0040af9722f4f94379b2acf7d86b0424717f4bde495a6cb442fd08

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gretl4py-0.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a0f0efd5bed9c789c5fd6f4481046d2e8ee8f97963b8758482e2aa07bea8dbef
MD5 4708514f78f02a9de9c957aac653025f
BLAKE2b-256 8e2fa7e72f033589231a8527d459645d528c19cf03e51a6d843714d0c7da2c8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gretl4py-0.4-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7343a5f447ea0549633d5aec9c2d1f53eb6a8d93497a5984a6e6b835c2caf186
MD5 d7bcc8f90aff6f637164eaa7bb78b221
BLAKE2b-256 699f370a9ef09e8117075c3231818afdd03cfc6307000ec9eafe65f69c657124

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gretl4py-0.4-cp312-cp312-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 ab21fa69e2d94d9f56e68b523cc98d85ed8db1eb146b26c9850401faa5ee8e0b
MD5 23fef9883bfd5b908aef2dcb06fab9e8
BLAKE2b-256 360ea5b6d99903720bbbd7bfe56c76b935a4a9046bf5317576ff9b915ecc17e8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gretl4py-0.4-cp311-cp311-win_arm64.whl
Algorithm Hash digest
SHA256 a7ae6abe6aeacfa36274ccf2c39ce6768bcc89d9a57d1c38951930fc6128fccf
MD5 4e57e9cd713ef464c406362bed4a2639
BLAKE2b-256 d94e7f3436447ce3576e3cbaea4017d40bfb801299e20745ba9db3d51d10dedd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gretl4py-0.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 32552437ea2e02bd4fe73a6b4792addf79375c66f715a31c9789ed7294254660
MD5 5840be96a2e2188205513790e3e2834d
BLAKE2b-256 a71701b48cf0ff1c3890a631a513de161b1167a85306221b4e3ac1d37423ac6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gretl4py-0.4-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 726cca33a3dae091c1ab6146ff9a1d31863c02b87a1d202348908e5f6ceae532
MD5 f0c735b25118db1971670dd830e56e26
BLAKE2b-256 9f845e16a96936a7778024771f49f43dc7f2badfec3b91fbea1f71bd0c89a198

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gretl4py-0.4-cp311-cp311-macosx_10_15_universal2.whl
Algorithm Hash digest
SHA256 3985b145076d6ef333a8267cfd8f5fd3b6abceb2da2cd76b1d0d78e95385777a
MD5 31208e997ee71e37732659076353b6d2
BLAKE2b-256 26c2f24690a9f143ae7e5c49cf5958f95f296adfdf18a83cc1ec4a580fb39eb7

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