Introduction to hansl Programming Course
by Artur T.
Dear gretl Mailing List,
I would like to share a small introductory course on programming with
gretl's scripting language, hansl. You can find the initial *five
lectures* available here, with more lectures to follow over the next
*2.5 months*.
https://github.com/gretl-project/hansl-coding
Additionally, the solution scripts for the exercises are located in the
"exercises" folder within the same repository. If you encounter any
errors or issues, please feel free to let me know by opening an issue on
GitHub.
This course is a side project of an actual introductory programming
lecture for business students that primarily uses Python. It's far from
being optimal, but still, I hope you find the materials helpful!
Best,
Artur
10 hours, 11 minutes
printf for string array
by Artur T.
Dear all,
I want to have a formatted printing of a string array:
<hansl>
strings S = defarray("A", "B", "C")
printf "My array: %s", S
</hansl>
This results in the error: "Data types not conformable for operation".
The help for the printf command says: "The format %s should be used for
strings." (last sentence in 1st paragraph). I guess that actually refers
to type "string". However, why shouldn't it work for an array of
strings, too?
Yes, I could (should?) make use of the flatten() function before
printing, but that does not feel natural (to me). Using the above code,
I would expect a line-by-line printout of the array items.
Sorry, I just recognize this E-Mail is a mixture of requesting help and
partially a kind of feature-request.
Best,
Artur
15 hours, 44 minutes
retirement of the gqtest contributed function package
by Sven Schreiber
Dear all,
the contributed but unmaintained function package "gqtest" is going to
be retired soon from the gretl package server.
The package implemented the old Goldfeld-Quandt test for heteroskedastic
residuals. However, nowadays this test is essentially irrelevant for
applied work --as also acknowledged in the package's help text--, the
standard recommendation would be to run something like the built-in
Breusch-Pagan test as a diagnostic.
(In scripting, you can do "modtest --breusch-pagan" with or without the
additional "--robust" switch. In the GUI in the window of your estimated
model, you would go to the menu Tests/Heteroscedasticity/Breusch-Pagan
or /Koenker. Of course, another option is to run White's test.)
Secondly, being unmaintained the package has had some technical issues
for quite some time now, and so the gretl team decided to retire it.
The package has been archived here:
https://github.com/gretl-project/gqtest. Of course, you can also keep a
local copy for yourself which will continue to work as always.
Thanks
Sven
3 days, 13 hours
Question on package thres_infer
by Andreas Zervas
Hi all, especially Sven,
I was playing with the package thres_infer, and it appears that the threshold estimates from functions H_thresh_test() and H_thresh_estim() differ. Is it intented? Should they be the same? In the particular example from the sample script, which I pasted below, the values are similar, but I run it with data that give totally different results.
Any thought - suggestions?
Best regards,
Andreas
gretl version 2024d
Current session: 2025-04-08 16:37
# Sample script for thresh_infer
Read datafile C:\Program Files\gretl\data\misc\denmark.gdt
periodicity: 4, maxobs: 55
observations range: 1974:1 to 1987:3
Listing 5 variables:
0) const 1) LRM 2) LRY 3) IBO 4) IDE
Test of Null of No Threshold Against Alternative of Threshold
Under Maintained Assumption of Homoskedastic Errors
Number of Bootstrap Replications: 1000
Trimming percentage: 0.150000
Threshold Estimate: 0.088000
(46 % of obs in 1st regime)
LM-test for no threshold: 4.154898
Bootstrap p-value: 0.923000
*******************************************
Threshold regression based on Hansen (2000)
User choice: assume homoskedasticity
*******************************************
Global OLS Estimation, Without Threshold
Dependent Variable: mg
OLS Standard Errors Reported
coefficient std. error z p-value
-------------------------------------------------------
Constant 0.0705718 0.0272334 2.591 0.0096 ***
IBO -0.469693 0.229408 -2.047 0.0406 **
IDE 0.110332 0.500081 0.2206 0.8254
Observations = 54
Degrees of Freedom = 51
Sum of Squared Errors = 0.0487311
Residual Variance = 0.000955512
R-squared = 0.162774
Heterosked. test p-val = 0.365732
*************************************************************
Threshold Estimation, dependent variable: mg
Threshold Variable: IDE
Threshold Estimate = 0.074 90% CI: [0.074, 0.11]
Sum of Sq. Errors = 0.0435625 Residual Var. = 0.000907553
Joint R-squared = 0.252
Heterosked. test p-value: 0.225
*************************************************************
Regime 1: IDE <= 0.074000
(standard errors do not take into account threshold uncertainty)
coefficient std. error z p-value
-------------------------------------------------------
Constant -0.833454 0.386015 -2.159 0.0308 **
IBO -0.774593 0.915857 -0.8458 0.3977
IDE 13.4116 6.06844 2.210 0.0271 **
Observations = 5
Degrees of Freedom = 2
Sum of Squared Errors = 0.00612267
Residual Variance = 0.00306133
R-squared = 0.425631
Regime 2: IDE > 0.074000
(standard errors do not take into account threshold uncertainty)
coefficient std. error z p-value
-------------------------------------------------------
Constant 0.0727286 0.0303053 2.400 0.0164 **
IBO -0.487763 0.233237 -2.091 0.0365 **
IDE 0.116314 0.505722 0.2300 0.8181
Observations = 49
Degrees of Freedom = 46
Sum of Squared Errors = 0.0374399
Residual Variance = 0.000813911
R-squared = 0.178561
2 weeks
Gretl in format snap or flatpak
by Carlos Andrade
Hello, friends.
I am a Debian 12 user and the version of gretl installed is 2022c. How do I
install a newer version? Is there a version in snap or flatpak format?
Atenciosamente,
Carlos Antonio Soares de Andrade
Economista e Consultor de Empresas
Telefone: (83) 9 98117113
2 weeks, 1 day
Soft threshold operator
by Riccardo (Jack) Lucchetti
Hi all,
yesterday me and a colleague found ourselves writing, for the millionth
time, a hansl function implementing the so-called "soft thresholding"
operator, and I was thinking that, although it's very easy, it'd be nice
if it were a builtin function. So I wrote a hansl function that IMO is
quite nice and general (works with scalars, series and matrices) and is
in the attached script, along with a few usage examples[*].
Note that the function could be made more general, for example
introducing the scalar rho as in
https://www.sciencedirect.com/topics/computer-science/soft-thresholding
, eq. (11.46) or allowing for "hard thresholding", like in the
Mathematica function "wthresh", but maybe not for now.
What I'm asking the community is:
1) Is it worthwhile having a dedicated function for this at all?
2) If so, should we have this as a builtin function[**], or should it
just be in extra?
3) Does anyone have better ideas on the function's signature?
[*] I know, it could have written in a cooler way by usign the sgn()
function and conditional assignment, but hey.
[**] We already have a C version for scalars in plugins/regls.c.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
2 weeks, 3 days