In trying to answer questions from some of my students, I did the following (using the data set "food.gdt" from Hill et al):
1) define x1 = 1/x
2) wls x1 y 0 x, save residuals uhat1
3) define ystar = y/sqrt(x), cstar = 1/sqrt(x), xstar = x/sqrt(x) (ie, wls "by hand")
4) ols ystar cstar xstar, save residuals uhat2
(I actually used the gui, but replicated this with the console)
I was surprised to find that uhat1 and uhat2 are different, even though the coefficient estimates are exactly the same. In fact, uhat2 = cstar*uhat1. Is this intended?
Dr. Peter Summers
Department of Economics
Texas Tech University
On Thu, 11 Nov 2010, Henrique Andrade wrote:
> I'm estimating a instrumental variable model and I
> need to test some restrictions. Please take a look
> at my script:
> open australia.gdt
> # TSLS
> tsls E const PAU PUS ; const PAU(-1) PUS(-1)
> b + b = 1
> end restrict
> Everything works fine, but I need the estimated
> parameters of the restricted model. Is this
gretl will do that automatically for you only if you're using OLS.
But you can do it yourself:
y = b1 + b2*x2 + b3*x3 + u
H0: b2 + b3 = 1
=> b3 = 1 - b2
=> y = b1 + b2*x2 + (1 - b2)*x3 + u
=> (y - x3) = b1 + b2*(x2 - x3) + u
y = E - PUS
x = PAU - PUS
tsls y const x ; const <your instruments here>
Dear Gretl Community,
I'm estimating a instrumental variable model and I
need to test some restrictions. Please take a look
at my script:
tsls E const PAU PUS ; const PAU(-1) PUS(-1)
b + b = 1
Everything works fine, but I need the estimated
parameters of the restricted model. Is this
Henrique C. de Andrade
Doutorando em Economia Aplicada
Universidade Federal do Rio Grande do Sul
What is the best way to construct commands such as GMM commands on the fly?
Assuming I have the string containing the GMM command to be executed, built
from other strings or from input file
How can I execute it?
With kind regards,
On Mon, 8 Nov 2010, Ofer Cornfeld wrote:
> I have been running GMM for a while with great results but
> sometimes the run finishes the following line is printed, with
> no further output
> Tolerance = 1e-018
Thanks for the report. What happened in the case where you saw no
output was that the "outer" iteration of iterated GMM failed to
converge. Normally you would see an error message in that case:
"The convergence criterion was not met"
but this was suppressed by your specification
set halt_on_error off
That was a bug: setting halt_on_error to "off" should stop gretl
from aborting the execution of a script on error, but it shouldn't
stop the printing of error messages; this is now fixed in CVS and
More substantively, the problem in this case was that the outer
GMM iteration had not converged within 200 iterations, where the
somewhat arbitrary maximum of 200 was hard-wired. In CVS and
snapshots I've done two things: (1) raised the maximum to 250, and
(2) provided a "set" variable, "gmm_maxiter", to control this
parameter. So, if you see the non-convergence error message from
iterated GMM and want gretl to try harder, you can now do, for
set gmm_maxiter 500
and try again.
I have been running GMM for a while with great results but sometimes the run
finishes the following line is printed, with no further output
Tolerance = 1e-018
I attach the script file, the output file and the data file.
With kind regards,
On Mon, 8 Nov 2010, artur tarassow wrote:
> I've got another issue with the "loop for" command. I attached a part
> of the code. The three loops do not seem to work for some reason. If I
> run the same procedure line by line everything works fine.
> loop for (i=2; i=l-1; i+=1) #This loop does not work
Do you really mean "i=l-1" for the second field in the "for"
construction here, and not "i<=l-1" (or "i<l")?
The second field has the status of a boolean condition: the loop
continues so long as it evaluates as true, so for example
loop for (i=3; i=6; i++)
will never run.
On Mon, 8 Nov 2010, Sergei B wrote (about Ignacio's solution for
deleting a large number of variables):
> Your solution seems to work, but only partially. I do manage to
> create a list with say 300 variables and then to delete it, but
> the main window of gretl seems not to get updated...
True enough. This should now be fixed in CVS.
In addition, the "confirm deletion" (of series) dialog box should
no longer show an excessively long list of variable ID numbers.
I am new to gretl and spent a great deal of time searching on this issue, but I
figured maybe some of you could help. I am attempting to replicate a forecasting
model using a probit regression. Please see link for a detailed description:
I created a binary file for recession, 1 indicating a recession, with NBER data.
I am trying to predict a univariate analysis using the difference of 3 month
tbill and 10 year tbill yields. I am using monthly data, whereas, most have used
quarterly. I am trying to forecast 12 months ahead and also generate a
"prob-of-recession vs spread" table which you can see in the link above.
I have devoted many hours searching and experimenting but I cannot figure out
how they obtain this data. Any and all help is truly appreciated. Many Thanks
I have a dataset with 400+ variables. Let's say I want to delete 300 of
them. If I select those 300 and press delete, gretl complains that
too many variables have been selected. Is there a way to get around this
issue (not selecting and delete every time around 100
My second question is that once those 100 variables have been selected and
gretl asks for confirmation of deletion, the list of
to be deleted variables goes beyond the right edge of the screen and I need
to move the window to the left few times before the "OK"
button becomes visible. Is this something that occurs on my system or is it
a normal behaviour of gretl?