How to get L2 and CWC variables quickly
by Ramki S
When working with panel data, I need to create the cwc (centered within cluster) variables quickly. Although there is "add time mean.." will do exaclty this job in creating L2 variable, I have to do one more step to create the cwc variable. Can we have some function to do the both? I am using the terminology used in multi-level models.
series Q_output_L2 = pmean(Q_output)
series Q_output_cwc = Q_output - Q_output_L2
series PF_fuelprice_L2 = pmean(PF_fuelprice)
series PF_fuelprice_cwc = PF_fuelprice - PF_fuelprice_L2
series LF_loadfactor_L2 = pmean(LF_loadfactor)
series LF_loadfactor_cwc = LF_loadfactor - LF_loadfactor_L2
1 month
Yahoo_get loading problem
by Ramki S
Hi, Anyone facing this problem? I tried on two different computers. Same Issue.
gretl version 2025b
Current session: 2026-09-24 15:48
? nulldata 271
periodicity: 1, maxobs: 271
observations range: 1 to 271
? setobs 5 2015-01-02
Full data range: 2015-01-02 - 2016-01-15 (n = 271)
? include yahoo_get.gfn
Error loading yahoo_get.gfn
Error executing script: halting
> include yahoo_get.gfn
1 month, 2 weeks
R in gretl error
by Ramki S
Hi,
If there is some error i encountered in gretl using R, like running pairs.panels without loading psych package, even after corrected the code, the old mistake is recycled.
<gretl>
foreign language=R --send-data
pacman::p_load(psych, dplyr)
df = gretldata
head(df)
pairs.panels(select(df, 1:4))
end foreign
</gretl>
output:
gretl version 2026b
Current session: 2026-09-26 22:37
? foreign language=R --send-data
? pacman::p_load(psych, dplyr)
? df = gretldata
? head(df)
? pairs.panels(select(df, 1:4))
? end foreign
Error in gretl.get.data() : could not find function "gretl.get.data"
Error in pairs.plot(df[, 1:4]) : could not find function "pairs.plot"
Error in pairs.plot(df[, 1:4]) : could not find function "pairs.plot"
Error in select(df, 1:4) : could not find function "select"
Error in UseMethod("select") :
no applicable method for 'select' applied to an object of class "c('mts', 'ts', 'matrix', 'array')"
Error in UseMethod("select") :
no applicable method for 'select' applied to an object of class "c('mts', 'ts', 'matrix', 'array')"
In addition: Warning message:
In par(old.par) : calling par(new=TRUE) with no plot
The process cannot access the file because it is being used by another process.
Error executing script: halting
> end foreign
1 month, 2 weeks
Split regression and Groupby Summary Statistics
by Ramki S
The R integration in gretl is so good and fast. I am trying to get similar results in Gretl.
1. summary statistics split by multiple variables
2. Split regression
Gretl has a function summary statistics factorized, but it takes only one variable and one split variable only.
The following code gives summary statistics for factor variables cyl and am on disp and mpg, Regression split by cyl.
foreign language=R
pacman::p_load(dplyr, fpp3, purrr, broom)
url = "https://gist.githubusercontent.com/seankross/a412dfbd88b3db70b74b/raw/5f2..."
mtcars <- readr::read_csv(url)
#summary statistics by group.
summarise(mtcars, .by = c(cyl, am),
across(
c(mpg, disp),
c(mean = mean, sd = sd, nobs = length)
)
)
# split regression
split(mtcars, mtcars$cyl) |> map(~ lm(mpg ~ disp, data = .)) |>
map(tidy) |> list_rbind(names_to = "id")
end foreign
Finally,
For pipe variable, R studio insert |> upon pressing ctrl+shift+m. Can we have similar in gretl?
1 month, 3 weeks
Making Gretl First hand choice
by Ramki S
I have seen a few threads talking about why Gretl is not as popular as R. Yes, R has wider eco-system and more packages. However, Gretl surely has its own advantages in terms of point and click interface and easy to start with. And I really love its speed and neat output. Its R integration is really working fast and smooth. After having worked with so many point and click softwares like SPSS, Stata, smartpls, pspp, matlab....and programming languages mainly R and Python, I would like to share my thoughts.
Gretl is great for time series and Gretl development should focus on making it first hand choice. Today when I try to replicate a book like Fpp3, still I am struggling with Naive forecasting and winters with inconsistent results. We also know that why python is considered great for machine learning because of consistent boilerplate code. Only the algorithm name changes, but all other steps remain the same. Split data into train and test, fit the model etc.
However, in case of Gretl, some times I need to add observations and some times the software gives option how many out of sample horizon you need. A user prefers, for any forecasting or smoothing method, the point and click should ask, how many in sample forecasts you need, and how many out-of-sample forecasts you need to predic. For train and test data it should provide common metrics, mape, rmse, mad etc. For each forecast it should be the way.
We don't have to be best in all types of data. For example, for experimental design, jamovi or spss are the best and it is enough to do any sort of analysis that is publication ready. And, some packages like vijplots are based on famous ggplot2 and they are excellent. Jtransform is based on dplyr and I can do many thing without coding in jamovi now for data manipulation.
We cannot expect, that these changes happen very soon, but over a period of time this consistent philosophy makes gretl the first choice for time series or any other analysis. Imagine the joy of a user who will replicate a book (Fpp3) based on a programming language but can do everything using point and click. It is great for teachers also to teach some thing first time to the students using gretl.
These are just my thoughts and no offence in any way.
1 month, 3 weeks
Package updates (August 2026)
by Riccardo (Jack) Lucchetti
Dear all, this message is to inform the community about the activity in
our function package repository. During the month of August 2026, 2
package were updated:
"lp-mfx", by Alllin Cottrell ( logit/probit marginal effects)
"TenTS", by Giovanni Ferretti (Tensor manipulation, especially for time
series)
Allin's update is a bugfix, for the case when computing average marginal
effects with ordered
logit or probit models. Giovanni's update adds two new functions for
tensor decomposition (CP and Tucker).
Download and enjoy!
--
-------------------------------------------------------
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
-------------------------------------------------------
1 month, 4 weeks