On Fri, 4 Sep 2020, Fred Morkel wrote:

One example: In our model, we estimate energy consumption by sectors with real 
production by sectors and the relative prices by sectors which is calculated as 
energy prices by sectors divided by output prices by sectors.
For this example, we then have 20 regressions due to 20 sectors and thus need 
to introduce 20 temporary variables which depict the aforementioned relative 
prices by sectors.
As we have many more estimations like this, partly for many more than 20 
sectors, you might get the picture. Most of the time, the temporary variables 
would not be used further.
Does this explain the problem better?

Yes, thanks, this is much clearer. But in a case such as yours, I would argue that a judicious use of loops would be advisable anyway. If temnporary variables are a problem, deleting them after use within the loop itself is rather simple. Better still, you could use a function and the temporary variables would automagically disappear after use. For example,

<hansl>
function void do_weird_regression(series y, series x)
    series tmp1 = log(x)
    series tmp2 = cos(x)
    series tmp3 = x/exp(x)

    ols y const tmp1 tmp2 tmp3
end function

nulldata 100

# generate example dataset

loop foreach i FOO BAR BAZ
    series y_$i = normal()
    series x_$i = uniform()
endloop

# example

do_weird_regression(y_FOO, x_FOO)

# better

loop foreach i FOO BAR BAZ
    do_weird_regression(y_$i, x_$i)
endloop
</hansl>



-------------------------------------------------------
  Riccardo (Jack) Lucchetti
  Dipartimento di Scienze Economiche e Sociali (DiSES)

  Università Politecnica delle Marche
  (formerly known as Università di Ancona)

  r.lucche...@univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-le...@gretlml.univpm.it
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/

Reply via email to