Thanks Artur!
No, the pmean() function is not useful because it relates to means across the time dimension.
But the pxmean() function in the PanelTools package does indeed appear to do essentially what I want to do. The documentation states
<<pxmean(const series y)
Compute mean value of y across all units per time period.
Missing values are ignored for computing the mean.
Parameters
• y, series, target series
Returns
Series with the mean value value across all units per
observation. NA values are completely ignored and are not
counted.>>
...and it appears that it computes my (1/N)*sum_{i=1}^N
[x{it}] term, including handling the case of an
unbalanced panel.
Thanks again!
I will explore the code and see whether this could be turned into a more massive operation (say to input a List and not a single variable, so that one can transform the whole sample in one stroke), and maybe I will return to this.
Alecos Papadopoulos PhD Affiliate Researcher Dpt of Economics, Athens University of Economics and Business Foundation for Economic and Industrial Research (IOBE) web: alecospapadopoulos.wordpress.com/ ORCID:0000-0003-2441-4550
Hi,
Am 18.05.25 um 14:27 schrieb Alecos Papadopoulos:
I want to transform the sample by subtracting from each data point the related group-mean, i.e. the mean value of the same (same by nature) variable across the dimension i=1,...,N
Namely to perform the operation
z_{it} = x_{it} (-) (1/N)*sum_{i=1}^N [x{it}],
i.e.
z_{it} = x_{it} (-) (1/N)*[x_{1t} + x_{2t} + ... + x_{Nt}]
and the same for the "y" variable, and any other variable in the sample.
Ideally, this has to work for both balanced and unbalanced panels., i.e. when the "N" may differ in each t time period.
Sorry, I haven't followed this closely enough. Just some spontaneous reaction: Isn't the pmean() function what you are looking for?
https://gretl.sourceforge.net/gretl-help/funcref.html#pmean
In the PanelTools package you also find the pxmean() function:
https://gretl.sourceforge.net/current_fnfiles/PanelTools.gfn
Best,
Artur
_______________________________________________ Gretl-users mailing list -- gretl-users@gretlml.univpm.it To unsubscribe send an email to gretl-users-leave@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/