Hi Daniel,
Am 04.01.2015 um 14:47 schrieb Daniel Bencik:
...
/list xVariables = park rr/
/ols xVariables[1] 0 xVariables[2]/
This already looks weird, the more natural thing to do would be:
<hansl>
ols park 0 rr
</hansl>
or if you would like to work with more generic names inside the 'ols'
command for programming reasons perhaps:
<hansl>
series lefthandside = park
list righthandside = const rr
ols lefthandside righthandside
</hansl>
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
What do you mean by "other datasets"? If they're not in the same
workfile, you would have to use some 'open' or perhaps 'append'
commands. Or do you simply mean other variables within the workfile?
...
# produce variable prefixes
/string xIsLogPrefix = ""/
/if xIsLog = 1/
/ xIsLogPrefix = "ln"/
/endif/
Just a hint about the so-called ternary assignment, you should be able
to use the following shorthand here:
<hansl>
string xIsLogPrefix = xIsLog==1 ? "ln" : ""
</hansl>
# create the names of variables
/strings //xVariableNames// = array(2)/
AFAIK all this array stuff in gretl/hansl is not very settled yet, I'm
not sure if it's the best approach for your problem. With string
substitution you can refer to your variables like this
</hansl>
ols @xIsLogPrefixMyVarname righthandside
<hansl>
The last line produces an error Im unable to graps/.
Guess what, if you don't tell us the error we are even more unable to
understand what's going on...
My feeling is that you should somehow try to separate the naming and
organization of your variables from whatever econometrics you want to
perform on them. Of course you can also do the re-naming/saving etc.
with gretl, but the steps can still be separated. Maybe some of the
steps are easier in the GUI instead of scripting.
hth,
sven