---------- Forwarded message ----------
Date: Sat, 1 Jul 2023 13:08:04 +0000
From: Allin Cottrell <cottrell(a)wfu.edu>
To: Josué Martínez-Castillo <jota3mc(a)gmail.com>
Subject: Re: 100-based indices with panel data
On Fri, 30 Jun 2023, Josué Martínez-Castillo wrote:
Hi,
I'm a newbie in gretl, very excited to learn how to use the program for
learning econometrics on my own. However, right now I'm curious on how to
estimate 100-based indices when dealing with panel data. For example, what
if I want to estimate a 100-based index for each unit using as base year
the first year available of, say, real GDP.
I was looking for the answer in the manual of the 2023 version of gretl. No
success. I was hoping maybe someone can help me with guidance.
Good question. As things stand there isn't a built-in way to construct such
indices for panel data using the graphical interface. But assuming you want the
indices to work in the time dimension for each panel unit, it's actually not
hard to do via scripting. Here's an example:
set verbose off
# load a supplied panel dataset
open grunfeld
# add a series to hold indices for the "invest" series
series invest_idx
# determine the number of panel units
N = max($unit)
# loop across the units
loop i=1..N
# restrict the sample range to unit i
smpl i i --unit
# calculate a portion of the full series
invest_idx = 100*invest/invest[$i:1]
endloop
# restore the full sample and inspect the result
smpl full
print invest_idx --byobs
In the example the base for the indices is the first observation for each unit
(unit $i, observation 1) but you could choose any period as the base.
We should probably find a way to offer this as a built-in thing.
Allin Cottrell