You nee to use the @ symbols to signify a string substitution. Try
ols @explainedVars[i] @explanatoryVars[j]
Sent from my T-Mobile 4G LTE Device
-------- Original message --------
From: Daniel Bencik <eubie(a)centrum.cz>
Date:12/26/2014 10:37 AM (GMT-06:00)
To: gretl-users <gretl-users(a)lists.wfu.edu>
Subject: [Gretl-users] Automating regressions on various variables
I have several measures of volatility v1, v2, v3 and their 5-day and 22-day averages
(v1_5, v1_22, etc.) loaded into the session. What I would like is to write a loop over the
explained and explanatory variables so that I have one code for OLS estimation into which
I just feed different data. The pseudocode should look something like this
strings explainedVars = array(3)
explainedVars = "v1"
explainedVars = "v2"
explainedVars = "v3"
strings explanatoryVars = array(9)
explanatoryVars = "v1(-1)"
explanatoryVars = "v1_5(-1)"
explanatoryVars = "v1_22(-1)"
explanatoryVars = "v3_22(-1)"
loop i = 1 to 3
loop j = 1 to 9
ols explainedVars[i] explanatoryVars[j]
The OLS line is the one that is not working for me, I do not know how to tell the
estimation command that the string explainedVars[i] should be taken as a series name. The
problem is naturally a simplified version of the real problem.
Any help is much appreciated,
Show replies by date