Gretl-Hansl "IDE" for Sublime editor
by Artur Tarassow
Dear all,
some weeks ago I've started to switch to the sublime editor
(https://www.sublimetext.com/) for writing gretl code.
Even though I like the simplicity of the gretl editor and its features
such as syntax highlighting and auto-itendation, it lacks some features
of modern IDEs such as "goto-anything", "goto-definition", custom
keybindings, fancy themes, git-implementation, snippets etc. which make
life much easier when working on larger projects. Don't get me wrong,
the gretl editor is great but was _never_ supposed to become a proper
software-development IDE but rather has another focus which is totally fine.
So I started to write the "Hansl-Gretl-Language" package for sublime
which includes the following features:
- 3 gretl build-systems (client mode, batch mode, and REPL mode) for
executing hansl code by means of sublime (plots are also working!)
- syntax-highlighting
- completion of gretl commands, accessors and keywords
- some snippet examples for speeding up coding
The project still has the following (known) issues:
- no auto-itendation (still have to figure out how this works)
- issues with some corner-cases which are not syntax-highlighted (regex
can become so hard!)
The package can be downloaded through sublimes package control system,
and can be found here:
https://packagecontrol.io/packages/Hansl-Gretl-Language
If somebody wants to participate on this project, check out the code on
my github repository:
https://github.com/atecon/Hansl-Gretl-Language
For those interesting in the sublime editor, check out "OdatNurd"'s
brilliant tutorials on youtube:
https://www.youtube.com/user/nurdz
Enjoy the package,
Artur
11 months, 1 week
Network Field Technician
by ashaikfe@gmail.com
A Network Field Technician is responsible for network development and maintenance in the field for any organization. The individual works with the organization’s technical team and its clients to install, configure, maintain, and fix all LAN/WAN and other equipment issues, ensuring efficient network functionality.
The technician maintains computer equipment, mobile devices, phones, cabling, routers, switches, and printers, among others, to address all of the client’s networking requirements either remotely or at the clients’ premises.
Read More: https://www.fieldengineer.com/skills/network-field-technician
3 years, 1 month
Gretl & online teaching
by Stefano Fachin
Like Sven mentioned, conference programs like Meet, Teams and Skype have
the option of sharing the "desktop", which sends to the audience the
entire screen of the lecturer as seen by him/her (at least in Window, do
not know about Mac OS)
bye
Stefano
--
________________________________________________________
Le informazioni
contenute in questo messaggio di posta elettronica sono strettamente
riservate e indirizzate esclusivamente al destinatario. Si prega di non
leggere, fare copia, inoltrare a terzi o conservare tale messaggio se non
si è il legittimo destinatario dello stesso. Qualora tale messaggio sia
stato ricevuto per errore, si prega di restituirlo al mittente e di
cancellarlo permanentemente dal proprio computer.
The information contained
in this e mail message is strictly confidential and intended for the use of
the addressee only. If you are not the intended recipient, please do not
read, copy, forward or store it on your computer. If you have received the
message in error, please forward it back to the sender and delete it
permanently from your computer system.
--
3 years, 9 months
Hamilton trend-cycle decomposition
by Riccardo (Jack) Lucchetti
Hi all,
yesterday, after having taught my students the HP decomposition, I
wondered if I should also tell them that one of the greatest time-series
econometricians on Earth recently wrote a rather scathing paper entitled
"Why You Should Never Use the Hodrick-Prescott Filter", where he proposes
a simple alternative.
So this morning I rustled up a little script with Hamilton's filter. Here
it is:
<hansl>
function series hamcycle(series y, bool do_plot[1], string title[null])
h0 = 2 * $pd
h1 = h0 + 4
list PROJ = y(-h0 to -h1)
ols y 0 PROJ -q
# ht = $yhat
hc = $uhat
if do_plot
if !exists(title)
title = argname(y)
endif
print title
diff8 = y - y(-h0)
setinfo diff8 --graph-name="Random walk"
setinfo hc --graph-name="Regression"
list PLT = diff8 hc
plot PLT
options time-series with-lines
literal set linetype 1 lc rgb "#ff0000"
literal set linetype 2 lc rgb "#000000"
literal set key top right
printf "set title '%s'", title
end plot --output=display
endif
return hc
end function
# example
nulldata 300
setobs 4 1947:1
open fedstl.bin
data gdpc1 expgsc1 pcecc96
list Y = gdpc1 expgsc1 pcecc96
LY = logs(Y)
strings Titles = strsplit("GDP Exports Consumption")
k = 1
# reproduce part of figure 6
loop foreach i LY --quiet
hc = hamcycle($i*100,,Titles[k++])
endloop
</hansl>
Should we turn this into a function package?
-------------------------------------------------------
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
-------------------------------------------------------
3 years, 11 months
std::string will cause 1.Gretl to delete all files in a folder and cause 2.correlogram_plot to not show plot C/C++ API
by riles@triton.net
Hello
Problem 1.
In the code below I have noticed that this line-> std::string what = "/why/do/I/delete";
will cause all files in this folder, set here line-> char work_dir[]="/home/ryan/workspace/TesterTest";
to be deleted. If this line is deleted or commented out line-> std::string what = "/why/do/I/delete";
then nothing gets deleted, i.e everything works fine.
Problem 2.
Now taking the code below, If you set this line-> int use_matrix = 1; /* or 0 */ as such and delete the following two lines
line-> char work_dir[]="/home/ryan/workspace/TesterTest/";
line-> strcpy(config_path.workdir ,work_dir);
then correlogram_plot will not show the plot if this line-> std::string what = "/why/do/I/delete";
is at the end of the program
Below is all the code needed to recreate the problem.
Is this a problem specific to me or is any one else able to recreate these two issues
Thank you
#include <iostream>
#include <sstream>
#include <fstream>
#include <gretl/libgretl.h>
#include <vector>
int arma_estimate (DATASET *dset, PRN *prn, int *resid_id)
{
MODEL *model;
int *list;
int err;
model = gretl_model_new();
list = gretl_list_new(5);
list[1] = 1; /* AR order */
list[2] = 0; /* order of integration */
list[3] = 1; /* MA order */
list[4] = LISTSEP; /* separator */
list[5] = 1; /* position of dependent variable in dataset */
*model = arma(list, NULL, dset, OPT_NONE, prn);
err = model->errcode;
if (err) {
errmsg(err, prn);
} else {
printmodel(model, dset, OPT_NONE, prn);
}
if (!err) {
/* save arma residual series? */
int v;
dataset_add_allocated_series(dset, model->uhat);
v = dset->v - 1 ; /* ID number of last series */
strcpy(dset->varname[v], "residual");
*resid_id = v;
model->uhat = NULL; /* don't double free! */
}
gretl_model_free(model);
free(list);
return err;
}
int CorrgramGretl (int varno, int order, int nparam, DATASET *dset,
gretlopt opt, PRN *prn)
{
int err;
err = corrgram(varno, order, nparam, dset, opt, prn);
if (err) {
errmsg(err, prn);
}
return err;
}
int main (void)
{
int use_matrix = 0; /* or 0 */
int use_residual = 1; /* or 0 */
int vnum; /* series ID for correlogram */
gretlopt opt = OPT_NONE;
DATASET *dset;
PRN *prn;
int err;
libgretl_init();
ConfigPaths config_path;
/* tell libgretl where to find gnuplot */
//gretl_set_path_by_name("gnuplot", "/usr/bin/gnuplot");
char gnu_dir[]="/usr/local/bin/gnuplot";
strcpy(config_path.gnuplot ,gnu_dir);
char work_dir[]="/home/ryan/workspace/TesterTest";
strcpy(config_path.workdir ,work_dir);
err = gretl_set_paths (&config_path);
dset = datainfo_new();
prn = gretl_print_new(GRETL_PRINT_STDOUT, NULL);
err = gretl_read_native_data("/usr/local/share/gretl/data/ramanathan/data9-7.gdt", dset);
if (!err && use_residual) {
opt = OPT_R;
err = arma_estimate(dset, prn, &vnum);
} else {
vnum = 2; /* or whatever */
}
if (err) {
errmsg(err, prn);
exit(EXIT_FAILURE);
}
int order = 7; /* or whatever */
if (use_matrix) {
/* call correlogram_plot() directly */
gretl_matrix *cmat;
cmat = acf_matrix(dset->Z[vnum], order, dset, dset->n, &err);
if (!err) {
/* take pointers into the two @cmat columns */
const double *acf = cmat->val;
const double *pacf = acf + cmat->rows;
/* set the plus/minus range */
double pm = 1.96 / sqrt(dset->n);
correlogram_plot(dset->varname[vnum], acf, pacf, NULL,
order, pm, opt);
}
gretl_matrix_free(cmat);
}
else {
/* emulate "command"-style call */
opt = OPT_U; /* add --plot=<whatever> */
/* supply the parameter to --plot */
set_optval_string(CORRGM, OPT_U, "display");
err = CorrgramGretl(vnum, order, 1, dset, opt, prn);
}
destroy_dataset(dset);
gretl_print_destroy(prn);
libgretl_cleanup();
std::string what = "/why/do/I/delete";
return 0;
}
4 years
how to avoid "useless" 0 after the decimal
by Artur Bala
Hi,
Is it possible to "force" Gretl to show/compute simply a "0" instead of a
"1.1102e-16"?
For example, in the script below the d series holds, in theory, nothing
else but 0-s but in practice it still holds some kinds of "1.1e-17"
numbers
nulldata 100
genr x=normal(0,1)
genr f=1/(1+exp(-x))
genr g=exp(x)/(1+exp(x)) # f = g
genr d=f-g # should be a series of 0
print d
summary d
Best,
Artur
4 years, 1 month
Repeatable crash using felogit package, if time dummies are included
by Fred Engst
Hi Allin and Jack,
I was trying to run a fixed effect logit model on the wagepan dataset using Jack’s felogit package (version 1.8), which I have installed as a menu item to use in the GUI.
After I provided the binary variable and a list of regressors in the dialog box, if I also selected the time dummies, gretl crashed once I hit ok. Without the time dummies, it worked fine.
I then run the same felogit package in a script, it worked fine without the time dummies, and crashed with time dummies are included.
Best,
Fred
Attached is the crash report using GUI.
4 years, 1 month
boolean TRUE and FALSE literals
by Sven Schreiber
Hi,
I've just noticed that the gretl changelog doesn't mention the
syntactical sugar that you can use TRUE for a boolean 1 and FALSE for 0
(since gretl 2020b).
So I thought I could also announce it here on the list.
Example:
<hansl>
if TRUE # case-sensitive, all caps
print "yay"
endif
</hansl>
cheers
sven
4 years, 1 month
C/C++ api function "corrgram()" does show ACF and PACF chart
by riles@triton.net
Hello
Everything plots/charts/works just fine when I use the GUI, but when I call corrgram(.......) using the api in C++ it does not show the graph. The function does compute and display the LAG ACF PACF Q-stat. [p-value], but it does not show the ACF and PACF charts.
I have also tired correlogram_plot (...), I get the following "Gnuplot is broken or too old: must be >= version 5.0", but as you see below my Gnuplot is >= 5.0 and when I use the GUI it plots the ACF and PACF just fine.
GNU Plot Version 5.2 patchlevel 8 last modified 2019-12-01.
OS = Ubuntu 18
GCC = version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
Below is the c++ code that calls the corrgram(...). There are 3 separate functions involved. The first two functions on this page are helper functions and the final function at the end is were I call corrgram(...).
Thank you for your help
Riley
template<typename T>
void ToGretl(std::vector<T> &data, DATASET *gretl_data_set, int pd, int structure, std::string variable_name){
/*
typedef struct {
int v; number of variables
int n; number of observations
int pd; periodicity or frequency of data
int structure; time series, cross section or whatever
double sd0; float representation of stobs
int t1, t2; start and end of current sample
char stobs[OBSLEN]; string representation of starting obs (date)
char endobs[OBSLEN]; string representation of ending obs
double **Z; data array
char **varname; array of names of variables
VARINFO **varinfo; array of specific info on vars
char markers; NO_MARKERS (0), REGULAR MARKERS or DAILY_DATE_STRINGS
char modflag; binary flag for dataset modified or not
char **S; to hold observation markers
char *descrip; to hold info on data sources etc.
char *submask; subsampling mask
char *restriction; record of sub-sampling restriction
char *padmask; record of padding to re-balance panel data
unsigned int rseed; resampling seed
int auxiliary; = 0 for regular dataset, 1 for aux dataset
char *pangrps; panel-only: name of series holding group names
int panel_pd; panel-only: panel time-series frequency
double panel_sd0; panel-only: time-series start
} DATASET;
*/
int nobs = data.size();
gretl_data_set->pd = pd;
gretl_data_set->structure = structure;//1=time series
//gretl_data_set = create_new_dataset (1,nobs, 0);
gretl_data_set->v = 1;//# of vars +1 becuase the dataset requires a constant
gretl_data_set->n = nobs;
gretl_data_set->t1 = 0;//this should be the same as i in for loop below;
gretl_data_set->t2 = nobs;//data.size();//this should be the same as i in for loop below;
//char f_[] = variable_name.c_str();
gretl_data_set->varname = (char **) malloc(sizeof(char *));//malloc(f_* sizeof(f_));
*gretl_data_set->varname = (char *) malloc(sizeof(char));//malloc(f_* size
strcpy(*gretl_data_set->varname, const_cast<char*>(variable_name.c_str()));
allocate_Z(gretl_data_set, OPT_B);
if(gretl_data_set != NULL){
int size_ = sizeof(gretl_data_set->Z)/sizeof(double);
for(int i = 0; i<nobs;++i){
gretl_data_set->Z[0][i] = data[i];
std::cout<<gretl_data_set->Z[0][i]<<std::endl;
}
}
}
template void ToGretl<double>(std::vector<double> &, DATASET *, int , int , std::string );
int CorrgramGretl(int varno, int order, int nparam, DATASET *dset, gretlopt opt, PRN *prn){
int err = 0;
err = corrgram (varno, order, nparam, dset, opt, prn);
return 0;
}
void DataEDA(){
for(auto it:cat_id_by_day){
Stats::Histogram hist_st;
auto cat_id = all_data.cat_id_map.find(it.first);
if(cat_id != all_data.cat_id_map.end()){
std::cout<<"Cat_Id "<<cat_id->second<<std::endl;
Stats::CalcSimpleStats(it.second, hist_st, 10, true);
//Stats::PlotLine()
libgretl_init();
DATASET *gretl_data_set;
PRN *prn;
MODEL *model;
gretl_data_set = datainfo_new();
//gretl_data_set->stobs = all_data.calendar_data.begin()->first.copy();
char* p2 = const_cast<char*>(all_data.calendar_data.begin()->first.c_str());
strcpy(gretl_data_set->stobs, p2);
char* p3 = const_cast<char*>(all_data.calendar_data.rbegin()->first.c_str());
strcpy( gretl_data_set->endobs, p3);
MyData::ToGretl(it.second,gretl_data_set,7,1, "test");
int err=0;
prn = gretl_print_new(GRETL_PRINT_STDOUT, NULL);
if (err) {
errmsg(err, prn);
exit(EXIT_FAILURE);
}
gretlopt opt = OPT_R;
// err = gnuplot_graph_wanted (PLOT_CORRELOGRAM, opt);
if (err) {
errmsg(err, prn);
}
std::cout<<"GNU Plot version "<<gnuplot_version()<<std::endl;
gretl_matrix *acf_mat;//const gretl_matrix *PM
// acf_mat = gretl_matrix_alloc(m, 100);
acf_mat = acf_matrix(gretl_data_set->Z[0], 100, gretl_data_set, gretl_data_set->n,&err);
const char *vname = "V2";
const double *acf=const_cast<const double* >( &acf_mat->val[0]);
const double *pacf=const_cast<const double* >( &acf_mat->val[1]);
int m = 30;
double pm = 1.0;
// err = correlogram_plot (vname,acf,pacf,acf_mat,m, pm,opt);
if (err) {
errmsg(err, prn);
}
err = Stats::CorrgramGretl(0, 100, 0, gretl_data_set, opt, prn);
if (err) {
errmsg(err, prn);
}
// err = Stats::ArmaEstimateGretl(gretl_data_set, prn, model, 1,1,1,0);
destroy_dataset(gretl_data_set);
gretl_print_destroy(prn);
libgretl_cleanup();
// working got putting arma_estimate into Stat.cpp function
// cleaning this funtion up and moving thing to their respective function
}
}
}
4 years, 1 month
Hard copy of User Guide - update?
by julesdavy@tutanota.com
Any chance of updating the hard copy of the Gretl User's Guide? I was going to purchase a copy of it from Amazon but see that it was published in 2016 and there have been quite a few changes since then. Thanks!
--
Securely sent with Tutanota. Get your own encrypted, ad-free mailbox:
https://tutanota.com
4 years, 1 month