Page 1 of 1
How to program tsls in order to save the coefficients?
Posted: Wed Aug 11, 2010 2:04 am
by vasilika
hello
I would like to use bootstrap in a tsls equation, therefore I will have to save the coefficients to use them for bootstraping.
If the equation was an OLS, I would write it as follows:
equation ols_reg.ls loan_boot = c(1)* (1/inf_boot-1/thold)+c(2)*do+c(3)*fs
how do I add the instrumental variables in this case and estimate a TSLS ?
thank you for your time.
Re: How to program tsls in order to save the coefficients?
Posted: Wed Aug 11, 2010 4:32 am
by trubador
Suppose that you have two instrumental variables called inst1 and inst2. Then you can estimate a tsls as follows:
equation ols_reg.tsls loan_boot = c(1)* (1/inf_boot-1/thold)+c(2)*do+c(3)*fs @ inst1 inst2
Please see the users guide for more details...
Re: How to program tsls in order to save the coefficients?
Posted: Wed Aug 11, 2010 4:43 am
by vasilika
This works
thank you for your reply
Re: How to program tsls in order to save the coefficients?
Posted: Wed Aug 11, 2010 6:21 am
by vasilika
however now I have a new problem
this is part of the program for bootstraping
for i = 1 to numobs
inf_boot(i) = inf(infdraws(i))
loan_boot(i) = slope_c1*(1/inf_boot(i)-1/thold)+slope_c2*do(i)+slope_c3*fs(i) @ inf(-1) do(-1) fs(-1)
in Bold are the instruments,
but the program won't run due to syntax errors, i believe because of the instruments.
If I refer to the instruments as inf(i-1) it won't work either. or should I just refer to them as just inf(i) as they are bootstrap values?
do you have any idea?
thank you
Re: How to program tsls in order to save the coefficients?
Posted: Wed Aug 11, 2010 6:51 am
by trubador
Programming errors arise from numerous reasons, and therefore it is very difficult to identify the problem just looking at a small portion of the code. For instance, control variables require an exclamation mark on the left:
Re: How to program tsls in order to save the coefficients?
Posted: Wed Aug 11, 2010 7:30 am
by vasilika
Actually the program runs, if I remove instruments and the equation is an OLS
the only problem is I want to add instruments,
i is defined as a scalar which takes the values I determine therefore it works.
Re: How to program tsls in order to save the coefficients?
Posted: Wed Aug 11, 2010 7:35 am
by EViews Gareth
You appear to be missing a TSLS command.
Re: How to program tsls in order to save the coefficients?
Posted: Thu Aug 12, 2010 12:23 am
by vasilika
Let me clarify this further
I estimate a TSLS equation
then I save the coefficients which I estimated in the first step
I use these coefficients to generate a bootstrap of the dependent variable
here is the program
equation ols_reg_orig.tsls loan = c(1)* (1/inf-1/thold)+c(2)*do +c(3)*fs @ inf(-1) do(-1) fs(-1)
slope_c1 = c(1)
slope_c2 = c(2)
slope_c3 = c(3)
for i = 1 to numobs
inf_boot(i) = inf(infdraws(i))
loan_boot(i) = slope_c1*(1/inf_boot(i)-1/thold)+slope_c2*do(i)+slope_c3*fs(i) @ inf(-1) do(-1) fs(-1)
next
My question is:
How to save the coefficients of the instruments so that I can use them in last step?
the last step (In bold) works if I remove the instruments.
Thank you for any suggestion.
Re: How to program tsls in order to save the coefficients?
Posted: Thu Aug 12, 2010 2:03 am
by trubador
I think you do not need that information. EViews simultaneously estimates the two stages and the resulting coefficients will directly give you TSLS estimates. So, indeed you should remove the instruments...
Re: How to program tsls in order to save the coefficients?
Posted: Thu Aug 12, 2010 2:12 am
by vasilika
so how do I get loan_boot(i) then?
Re: How to program tsls in order to save the coefficients?
Posted: Thu Aug 12, 2010 2:34 am
by trubador
I am not sure if this is the correct way of bootstrapping. If you are interested, EViews has useful commands to ease the bootstrapping procedure. You can directly generate loan_boot series through the following equation:
Code: Select all
loan_boot = slope_c1*(1/inf_boot-1/thold)+slope_c2*do+slope_c3*fs
Of couse, you need to generate inf_boot series beforehand...
Re: How to program tsls in order to save the coefficients?
Posted: Thu Aug 12, 2010 2:42 am
by vasilika
which I have already done.
So, you are saying that as long as I use bootstraped values of inf, than I don't need to use instruments in order to get the bootstraped values of loan_boot?