Python bindings for gretl
Project description
gretl4py: Python Bindings for gretl
This package provides Python bindings to the gretl econometrics library via its official C API.
For full documentation, please visit the gretl4py project page <https://gretl.sourceforge.net/gretl4py.html>_.
.. note::
The official PDF documentation is still under development and requires updates and enhancements.
You can find useful example scripts in the demo/ subdirectory. <https://sourceforge.net/p/gretl/gretl4py/ci/v0.2/tree/demo/>_.
Package Contents
libgretl(including plugins) and its dependenciesgretl4pybinary module bridging Python withlibgretlvia its official API- Python extensions supporting the binary module
- Example Python scripts in the
examples/directory - Sample datasets in the
data/directory
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 are dataset-based, while others are model-based.
Usage
- Loading Datasets
Supported formats: ``.gdt``, ``.gdtb``, ``.csv``, ``.dta``, ``.wf1``, ``.xls``, ``.xlsx``, ``.ods``
Use ``get_data()`` to load a dataset:
.. code-block:: python
import importlib.resources as resources
import gretl
data_dir = resources.files('gretl').joinpath('data')
d1 = gretl.get_data(str(data_dir.joinpath('bjg.gdt')))
.. note::
The first dataset loaded is automatically set as the default.
**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
2. Estimating Models
Basic usage pattern:
.. code-block:: python
m = gretl.ESTIMATOR() m.fit()
To pass a dataset explicitly, use the data=... keyword argument.
Example: OLS Regression
.. code-block:: python
m1 = gretl.ols(formula='g ~ const + lg').fit() print(m1)
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
To view the source of ols.py:
.. code-block:: python
import inspect import gretl.examples.estimators.ols
print(inspect.getsource(gretl.examples.estimators.ols.run_example))
To run the example:
.. code-block:: python
import gretl.examples.estimators.ols
gretl.examples.estimators.ols.run_example()
API Overview
class _gretl.Dataset
**Attributes:**
- ``is_default``
- ``source``
**Methods:**
::
__copy__, __repr__, bwfilt, bkfilt, get_accessor, get_id, get_series,
hpfilt, linked_models_list, new_list, new_series, print, sample,
setobs, set_as_default, test, to_dict, to_file, varnames
``class _gretl.Model``
~~~~~~~~~~~~~~~~~~~~~~
**Methods:**
::
fcast, fit, get_accessor, get_formula
``class _gretl.Model_NSE``
Methods:
::
restrict, test
class _gretl.Model_GretlModel_VAR
**Methods:**
::
irf, test
``class _gretl.GretlModel_VAR_VECM``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Methods:**
::
restrict
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 Distributions
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 gretl4py-0.2.tar.gz.
File metadata
- Download URL: gretl4py-0.2.tar.gz
- Upload date:
- Size: 674.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4952c470ee140d97e35a2899a75229ddb45936f98bb530a13a9adc0d71ce4d99
|
|
| MD5 |
952ac9903bd38e2e2783252131227e18
|
|
| BLAKE2b-256 |
c6d45fab4d5bdcf6e63cbf9dd7cc1f45e633d66d016429dff0c9addbabe97e6d
|
File details
Details for the file gretl4py-0.2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: gretl4py-0.2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 39.4 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4af78c8125edac736867df0d76f701b79fcc09afbc6dee3d8d81a25cdecd5da
|
|
| MD5 |
5b66eb7e02519dad60a0cfcc2bb49784
|
|
| BLAKE2b-256 |
b59e4bfb49d7c14cf71720b6f9ec36faa85598befe858a89ed58d93e4de15d07
|
File details
Details for the file gretl4py-0.2-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: gretl4py-0.2-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 39.5 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9e12048337b1b0eda38159b4f52b08f34787356a85a306868c2923ccc185ce5
|
|
| MD5 |
efd34b904ba25622fb3f71ac57800a96
|
|
| BLAKE2b-256 |
8aade55fbbc63b034ab2343d8c35975ec7be847c7196a294fb3750c75890c455
|
File details
Details for the file gretl4py-0.2-cp313-cp313-macosx_10_15_universal2.whl.
File metadata
- Download URL: gretl4py-0.2-cp313-cp313-macosx_10_15_universal2.whl
- Upload date:
- Size: 25.0 MB
- Tags: CPython 3.13, macOS 10.15+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b263d2a53fb0757535acb4395170bc67f51ed490d8cdcfe084a2219c363acee
|
|
| MD5 |
67f41713e6108a9079d1ea5163e29133
|
|
| BLAKE2b-256 |
fd1515b2bec898b4a002c34acdb23ebec58ac15d38c4ccea495e3d1a40162ca7
|
File details
Details for the file gretl4py-0.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: gretl4py-0.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 39.4 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac43c10f41f26f85e8b43f6af5a763a821a5597059f1a685cc1f17bbcde12701
|
|
| MD5 |
6522ad770b361f36a777fdfa81b69bca
|
|
| BLAKE2b-256 |
ca00772dc9f62e5980e718b9cde09a93a26d48d25e5b40748723ae608d45bb06
|
File details
Details for the file gretl4py-0.2-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: gretl4py-0.2-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 39.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a9120b8893dbafb179b51dade5657ff8f4f8827d685df85954b3b0f1c447461
|
|
| MD5 |
5b5216600e06b1194ae29f8d88441f5e
|
|
| BLAKE2b-256 |
19f7bcf0bdcccb95ef1f1d0fec182b6c8e8bee122bc0d0b8954ce17ada727b4a
|
File details
Details for the file gretl4py-0.2-cp312-cp312-macosx_10_15_universal2.whl.
File metadata
- Download URL: gretl4py-0.2-cp312-cp312-macosx_10_15_universal2.whl
- Upload date:
- Size: 25.0 MB
- Tags: CPython 3.12, macOS 10.15+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8230a08f9d0e9f2784f75dd29034597eff4aa06ea6b3d9629f85f97a4a6427e8
|
|
| MD5 |
2bca0c72ab44b0e988a1e8e671133c5d
|
|
| BLAKE2b-256 |
2bf1d88b5ded4349f70391b057aea9ca9a5558854b586550ed3ff5061b4baa02
|
File details
Details for the file gretl4py-0.2-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: gretl4py-0.2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 40.0 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
324801319fff60a15b132625f9cd13b21af51ce582ec44ec1febf58d91c59f52
|
|
| MD5 |
7d4f2d0ecc97144e053466a58b544c16
|
|
| BLAKE2b-256 |
c4d49d182021e3064096387f1e87d06240f38167f61e88aa44e3ee462e35e0ff
|
File details
Details for the file gretl4py-0.2-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: gretl4py-0.2-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 39.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
578befa402dd16a8ef47a09cf6503326652145fdca99b72f0e4b3998c6015edc
|
|
| MD5 |
172b3a622c95faab13b3ea6a6631c4c9
|
|
| BLAKE2b-256 |
9972559caa37f581b4802b818f6b8656fd9d6d18b46bb3859443fbf50a4f7d5d
|
File details
Details for the file gretl4py-0.2-cp311-cp311-macosx_10_15_universal2.whl.
File metadata
- Download URL: gretl4py-0.2-cp311-cp311-macosx_10_15_universal2.whl
- Upload date:
- Size: 25.0 MB
- Tags: CPython 3.11, macOS 10.15+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b66197129844817e2e7b53e1857574a878fb1003ac059b7dec7258d2a275095b
|
|
| MD5 |
5e4498aa852521fe0bdd609ddab0bbc3
|
|
| BLAKE2b-256 |
3fc65a3bc92c3e15f73a41a02d1bbbd29dda45e333d78107024705f7104c8354
|