Dear group,
I am sorry to be bothering this mailgroup with such beginner questions, but I have nowhere
else to ask and frankly, gretl is too good to pass up.
Lets say I have two time series variance measures "park" and "rr" in
my dataset. Having learnt from previous threads, I put both into a list and run a
regression ...
list xVariables = park rr
ols xVariables[1] 0 xVariables[2]
On top of that, I have three other datasets where I have volatility, ln(variance) and
ln(volatility), stored e.g. as sqrtpark, sqrtrr, lnpark, lnrr .. etc. What I would love to
have is a script, that can run the same battery of HAR models on all four datasets, with
the help of some flags. The idea is something like this
# define we have the log volatility dataset
scalar xIsLog = 1
scalar xIsVolatility = 1
# produce variable prefixes
string xIsLogPrefix = ""
if xIsLog = 1
xIsLogPrefix = "ln"
endif
string xIsVolatilityPrefix = ""
if xIsVolatility = 1
xIsVolatilityPrefix = "sqrt"
endif
# create the names of variablesstrings xVariableNames = array(2)
xVariableNames[1] = xIsLogPrefix
xVariableNames[1] += xIsVolatilityPrefix
xVariableNames[1] += "park"
#produce "lnsqrtpark "
xVariableNames[2] = xIsLogPrefix
xVariableNames[2] += xIsVolatilityPrefix
xVariableNames[2] += "rr" #produce
"lnsqrtrr"
# finally, make a list of variables based on their names
list xVariables = @xVariableNames[1] @xVariableNames[2]
The last line produces an error Im unable to graps. Is there a workaround or do I need to
have a different script for each dataset? As an additional question, can I somehow get the
name of currently opened dataset? If yes, xIsLog and xIsVolatility could be set
automatically and it would make the script much more elegant.
Thank you and best regards,
Daniel