# Gretl

**Gretl**（Gnu Regression, Econometrics and Time-series Library，即GNU回归、[计量经济学](https://www.edgepedia.org/zh/econometrics)与时间序列库）是一个自由、开源的跨平台计量经济学分析软件包，以C语言编写，在[GNU通用公共许可证](https://www.edgepedia.org/zh/gnu-general-public-license)下分发。<sup>[1](https://gretl.sourceforge.net/index.html)</sup> 它源自拉穆·拉马纳坦（Ramu Ramanathan）为其计量经济学程序ESL开源发布的C代码，目前由维克森林大学（Wake Forest University）的阿林·科特雷尔（Allin Cottrell）和马尔凯理工大学（Università Politecnica delle Marche）的里卡多·“杰克”·卢凯蒂（Riccardo "Jack" Lucchetti）维护。<sup>[1](https://gretl.sourceforge.net/index.html)</sup> 该项目自2000年1月在[SourceForge](https://www.edgepedia.org/zh/sourceforge)上纳入版本控制以来，一直处于持续活跃开发之中。<sup>[2](https://users.wfu.edu/cottrell/hansl.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 许可证与价格 | 基于GPLv3或更高版本的自由开源软件；无订阅、无许可证密钥；被自由软件基金会列为GNU软件包<sup>[1](https://gretl.sourceforge.net/index.html)</sup><sup> • </sup><sup>[3](https://directory.fsf.org/gretl.html)</sup><sup> • </sup><sup>[4](https://gretl.org/)</sup> |
| 估计方法 | 最小二乘法、最大似然、GMM、LASSO/岭回归/弹性网、ARIMA、GARCH各变体、VAR/VECM/SVAR、卡尔曼滤波、logit/probit/tobit、样本选择、计数与持续时间模型、面板估计量（含动态面板GMM）<sup>[1](https://gretl.sourceforge.net/index.html)</sup> |
| 脚本 | 内置语言hansl，支持矩阵运算、循环、条件语句、函数定义，以及通过MPI实现并行化<sup>[1](https://gretl.sourceforge.net/index.html)</sup> |
| 互操作性 | 可与GNU R、Octave、Python、Julia、Ox和Stata对接；可导入Stata .dta、SPSS .sav、Excel、CSV及其他格式；可将模型输出为LaTeX<sup>[1](https://gretl.sourceforge.net/index.html)</sup> |
| 最新版本 | gretl-2026b，发布于2026年4月30日<sup>[1](https://gretl.sourceforge.net/index.html)</sup><sup> • </sup><sup>[5](https://gretlml.univpm.it/hyperkitty/list/gretl-users@gretlml.univpm.it/thread/TGIVDINPGN3Q6MMC44M57CUCRONHD4P7/)</sup> |
| 系统要求 | Windows 10+ 64位、macOS 11+（Intel与Apple Silicon）、Linux；约200 MB磁盘空间和2 GB内存；绘图需gnuplot 5.2或更高版本<sup>[4](https://gretl.org/)</sup><sup> • </sup><sup>[1](https://gretl.sourceforge.net/index.html)</sup> |
| 社区 | 第九届双年gretl会议于2025年6月19日至20日在伯明翰大学举行；2021年11月至2023年gretl会议期间，205个函数包下载量约68,000次<sup>[1](https://gretl.sourceforge.net/index.html)</sup><sup> • </sup><sup>[6](https://gretlconference.org/wp-content/uploads/2023/06/cottrell.pdf)</sup> |

## Gretl是什么

该软件包由三部分组成：libgretl，一个计量经济学估计函数的共享库；一个命令行客户端；以及一个基于GTK+构建的图形界面客户端。<sup>[7](https://github.com/gretl-project/gretl)</sup> Libgretl源自ESL——拉马纳坦在加州大学圣迭戈分校（UC-San Diego）经济系编写的独立命令行程序。<sup>[7](https://github.com/gretl-project/gretl)</sup> 该项目自2001年9月22日起在SourceForge注册，在37条评价中获得4.6分（满分5星）的用户评分。<sup>[8](https://sourceforge.net/projects/gretl/)</sup>

开发由科特雷尔主导，他在GitHub镜像上的贡献数为28,167次，其次是卢凯蒂（527次）及其他贡献者。<sup>[7](https://github.com/gretl-project/gretl)</sup> 自由软件基金会目录将科特雷尔列为作者和维护者，GPLv3或更高版本的许可证于2022年2月由FSF验证。<sup>[3](https://directory.fsf.org/gretl.html)</sup> 项目周围有社区基础设施：一个维基网站、邮件列表，以及一系列双年会议，先后在毕尔巴鄂（2009）、托伦（2011）、[俄克拉何马城](https://www.edgepedia.org/zh/oklahoma-city)（2013）、柏林（2015）、雅典（2017）、那不勒斯（2019）、格但斯克（2023）和[伯明翰](https://www.edgepedia.org/zh/birmingham)（2025）举行。<sup>[1](https://gretl.sourceforge.net/index.html)</sup>

## 功能与方法

Gretl支持广泛的估计方法：最小二乘法、最大似然和GMM；正则化最小二乘（LASSO、岭回归、弹性网）；ARIMA和GARCH各变体；VAR、VECM（含结构VAR）；单位根与[协整检验](https://www.edgepedia.org/zh/cointegration-test)；[卡尔曼滤波](https://www.edgepedia.org/zh/kalman-filter)；logit、probit、tobit、样本选择、计数和持续时间模型；以及面板数据估计量（含动态面板GMM）。<sup>[1](https://gretl.sourceforge.net/index.html)</sup> 脚本语言支持混合时间序列频率（MIDAS），并通过LIBSVM支持机器学习。<sup>[1](https://gretl.sourceforge.net/index.html)</sup>

**图形界面与脚本共享同一引擎。** 与R或Matlab不同，gretl将程序与其脚本语言分离：菜单驱动的图形界面与hansl脚本驱动相同的估计功能，仅有少数例外，如卡尔曼滤波只能通过hansl访问。<sup>[2](https://users.wfu.edu/cottrell/hansl.pdf)</sup> 模型可导出为表格或方程格式的LaTeX文件，数据可从CSV、Excel、Gnumeric、Open Document、Stata .dta、SPSS .sav、EViews工作文件、JMulTi、RATS 4和PC-Give数据库读取。<sup>[1](https://gretl.sourceforge.net/index.html)</sup>

## 与R、Stata和EViews的比较

Hansl以简洁为设计目标。将A的转置乘以B，在hansl中只需1个符号，Matlab中需2个，R中需6个。<sup>[2](https://users.wfu.edu/cottrell/hansl.pdf)</sup> 结构方面则另有不同：hansl支持函数定义、循环、条件语句和复杂数据结构。<sup>[2](https://users.wfu.edu/cottrell/hansl.pdf)</sup> 开发者表示，gretl可与Stata、EViews和R相媲美。<sup>[2](https://users.wfu.edu/cottrell/hansl.pdf)</sup>

差距在于广度与生态。Gretl自身的宣传材料指出，其第三方插件生态比Stata或R小，图形界面样式不够精致，高级贝叶斯方法不如专用软件包丰富。<sup>[4](https://gretl.org/)</sup> 该软件包的开发者同样表示，其统计方法覆盖范围不如GNU R全面。<sup>[9](https://techyorker.com/compare/pyms-vs-eviews-vs-gretl-vs-stata/)</sup> 价格上的差异则很大：gretl免费，而2026年某比价网站列出EViews大学版起价为每月59.95美元。<sup>[9](https://techyorker.com/compare/pyms-vs-eviews-vs-gretl-vs-stata/)</sup>

## 数据一览

函数包是引入社区贡献方法的扩展机制，在2021年11月至2023年gretl会议期间，205个函数包录得约68,000次下载；165个包下载量超过100次，69个超过400次，下载量最高的单个包lp-mfx达到1,276次。<sup>[6](https://gretlconference.org/wp-content/uploads/2023/06/cottrell.pdf)</sup> 2024c版本（2024年10月）的发布文件从14.8 MB的源码压缩包到44.8 MB的Windows 64位安装程序不等，最新列出的macOS Intel包为49.0 MB。<sup>[10](https://sourceforge.net/projects/gretl/files/gretl/2024c/)</sup> 2023c、2024a至2024c、2025b和2026b各版本均记录在更新日志中。<sup>[11](https://gretl.sourceforge.net/ChangeLog.html)</sup>

## Gretl在教学与研究中的应用

教学用途是记录最充分的应用。米克森（Mixon）与史密斯（Smith）2006年在《应用计量经济学杂志》（*Journal of Applied Econometrics*）上的评论评估了gretl在本科计量经济学教学中的作用，该文由一位教师和一名学生合写，并简要讨论了gretl作为研究工具的应用。<sup>[12](https://onlinelibrary.wiley.com/doi/10.1002/jae.927)</sup> 李·阿德金斯（Lee Adkins）的免费配套手册将gretl对应到基于希尔（Hill）、格里菲思（Griffiths）和林（Lim）《计量经济学原理》（*Principles of Econometrics*）的本科与硕士课程体系，涵盖OLS、IV、ARCH/GARCH和受限因变量模型，教材数据以软件包形式提供。<sup>[13](https://www.le.ac.uk/users/dsgp1/COURSES/THIRDMET/MANUALS/ebook.pdf)</sup> 一项针对奥维耶多大学（University of Oviedo）课程145名学生的调查发现，学生认为gretl明显满足了灵活性和友好性的要求，而在功能性方面的结论则因项目而异：学生对工作文件选项和gretl控制台表现出强烈的不满。<sup>[14](https://gretlconference.org/wp-content/uploads/2022/09/12-05-Lopez-Menendez_Perez-Suarez.pdf)</sup>

塔拉索（Tarassow）2019年在《澳大利亚经济评论》（*Australian Economic Review*）上的文章介绍gretl既能满足不同层次的教学需求，又提供了专业工作所需的功能，并演示了在gretl中估计VAR用于结构分析和预测。<sup>[15](https://ideas.repec.org/a/bla/ausecr/v52y2019i2p255-271.html)</sup> 2025年一项对EViews、jamovi、JASP、gretl、JMulTi、RapidMiner和JAGS的比较评论特别关注开源程序的可及性和教育潜力，结论是软件选择是组织科学与教育过程的一个战略性步骤。<sup>[16](https://s-lib.com/en/issues/eiu_2025_11_v6_a4/)</sup>

## 互操作性

Gretl可与GNU R、GNU Octave、Python、Julia、Ox和Stata集成，并提供了一个名为gretl4py的Python工具。<sup>[1](https://gretl.sourceforge.net/index.html)</sup> 与R的集成最为紧密：较新的函数包功能包括一套R设置机制，使R函数可以像hansl函数一样被调用，从而有效地将gretl用作选定R包的前端。<sup>[6](https://gretlconference.org/wp-content/uploads/2023/06/cottrell.pdf)</sup> 在2026b中，foreign命令块新增了--send-data支持，可通过Pandas执行Python脚本。<sup>[5](https://gretlml.univpm.it/hyperkitty/list/gretl-users@gretlml.univpm.it/thread/TGIVDINPGN3Q6MMC44M57CUCRONHD4P7/)</sup> gretl服务器上已有100多个hansl函数包，涵盖边际效应、门槛面板模型、结构突变和稀疏矩阵等方法。<sup>[2](https://users.wfu.edu/cottrell/hansl.pdf)</sup>

## 近期进展

近期版本集中在面板推断、正则化和平台覆盖方面：

- **2023b/c。** regls附加组件新增LASSO、岭回归和弹性网；面板--cluster支持新增双向聚类和Driscoll-Kraay协方差估计量（此前仅在贡献的CSDpanel包中提供）；原生gridplot命令可将子图排列为矩形网格，基本取代了贡献的multiplot包。<sup>[11](https://gretl.sourceforge.net/ChangeLog.html)</sup><sup> • </sup><sup>[17](https://gretlwiki.econ.univpm.it/index.php/Blog)</sup>
- **2024a-c。** tsls中Hausman检验新增--matrix-diff选项，采用帕达多普洛斯（Padadopoulos）方法（《计量经济学》，2023）；新增狄利克雷分布和通用离散随机数分布；reset新增--robust选项；SVAR附加组件增强了对符号约束模型的支持。<sup>[11](https://gretl.sourceforge.net/ChangeLog.html)</sup>
- **2025b（2025年6月）。** 新增Windows on ARM64软件包；修复卡尔曼滤波扰动平滑器（de Jong变体）；删除已弃用的eigengen()函数；新增便于gretl4py使用的代码。<sup>[18](https://gretlml.univpm.it/hyperkitty/list/gretl-announce@gretlml.univpm.it/thread/MLBED256VLLX3RGGPXIMHVG24IXDM6RC/)</sup>
- **2026b（2026年4月）。** 新增函数which()和fols()用于因子化最小二乘，支持[截断正态分布](https://www.edgepedia.org/zh/truncated-normal-distribution)，新增VECM长期协方差输出（Johansen的C及协方差和标准误）；Windows ARM64构建包含MPI和X-13ARIMA-SEATS的ARM64构建，Mac构建将GTK3更新至3.24.52。<sup>[11](https://gretl.sourceforge.net/ChangeLog.html)</sup><sup> • </sup><sup>[5](https://gretlml.univpm.it/hyperkitty/list/gretl-users@gretlml.univpm.it/thread/TGIVDINPGN3Q6MMC44M57CUCRONHD4P7/)</sup>

## References

1. [gretl — Gnu Regression, Econometrics and Time-series Library (official project site)](https://gretl.sourceforge.net/index.html)
2. [Hansl: a DSL for econometrics (Cottrell & Lucchetti)](https://users.wfu.edu/cottrell/hansl.pdf)
3. [Gretl - Free Software Directory](https://directory.fsf.org/gretl.html)
4. [Gretl Data Analysis Software for Econometrics & Statistics (gretl.org)](https://gretl.org/)
5. [gretl 2026b released - Gretl-users mailing list](https://gretlml.univpm.it/hyperkitty/list/gretl-users@gretlml.univpm.it/thread/TGIVDINPGN3Q6MMC44M57CUCRONHD4P7/)
6. [New developments for gretl function packages (Cottrell, gretl conference)](https://gretlconference.org/wp-content/uploads/2023/06/cottrell.pdf)
7. [gretl-project/gretl (official GitHub mirror)](https://github.com/gretl-project/gretl)
8. [gretl download | SourceForge.net](https://sourceforge.net/projects/gretl/)
9. [PyMS vs EViews vs gretl vs Stata (TechYorker comparison)](https://techyorker.com/compare/pyms-vs-eviews-vs-gretl-vs-stata/)
10. [gretl - Browse /gretl/2024c at SourceForge.net](https://sourceforge.net/projects/gretl/files/gretl/2024c/)
11. [gretl changelog (official release notes)](https://gretl.sourceforge.net/ChangeLog.html)
12. [Teaching undergraduate econometrics with GRETL (Mixon & Smith, Journal of Applied Econometrics, 2006)](https://onlinelibrary.wiley.com/doi/10.1002/jae.927)
13. [Using gretl for Principles of Econometrics, 3rd edition (Adkins, 2007)](https://www.le.ac.uk/users/dsgp1/COURSES/THIRDMET/MANUALS/ebook.pdf)
14. [Facing the Four-F Test: Gretl's Achievements and Challenges (López-Menéndez & Pérez Suárez)](https://gretlconference.org/wp-content/uploads/2022/09/12-05-Lopez-Menendez_Perez-Suarez.pdf)
15. [Practical Empirical Research Using gretl and hansl (Tarassow, Australian Economic Review, 2019)](https://ideas.repec.org/a/bla/ausecr/v52y2019i2p255-271.html)
16. [A Comparative Review of Software Tools for Economic Research (Litvinenko, Barykin & Dedyukhina, 2025)](https://s-lib.com/en/issues/eiu_2025_11_v6_a4/)
17. [Blog - GretlWiki](https://gretlwiki.econ.univpm.it/index.php/Blog)
18. [gretl 2025b released - Gretl-announce mailing list](https://gretlml.univpm.it/hyperkitty/list/gretl-announce@gretlml.univpm.it/thread/MLBED256VLLX3RGGPXIMHVG24IXDM6RC/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Oct 10, 2026 · Edited: Oct 10, 2026; Oct 11, 2026; Oct 15, 2026; Oct 25, 2026 · Last review: Oct 10, 2026*

Topic: 社会与历史 › 经济与商业 › 经济学 › Economic theory and methods › Econometrics and quantitative methods › Econometric software

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/gretl

English original: https://www.edgepedia.org/gretl
