Page 2 of 3

Re: Holtz-Eakin-Newey-Rosen example

Posted: Mon Aug 23, 2010 1:21 pm
by cv003h
Thanks Tom. If I use the second, hetersked...consistent 2SLS, I probably need to add the "define=" code to the linreg statement, right?

Re: Holtz-Eakin-Newey-Rosen example

Posted: Mon Aug 23, 2010 3:04 pm
by TomDoan
cv003h wrote:Thanks Tom. If I use the second, hetersked...consistent 2SLS, I probably need to add the "define=" code to the linreg statement, right?
The DEFINE in the first two are used to set up the model for 3SLS. So if you want to do the HAC 2SLS, then the 3SLS, then yes, you would want the defines on the 2SLS instructions.

Re: Holtz-Eakin-Newey-Rosen example

Posted: Thu Aug 26, 2010 10:26 am
by cv003h
Two more questions.

In the original paper, the authors talk about "partial differencing", which is equivalent to simple differencing if the coefficients on the firm effect remain unchanged. Does the code you posted assume that, or is there some partial differencing going on behind the scenes?

Secondly, how would I modify the code to uncover year-by-year coefficients rather than estimating a single coefficient for the entire time period?

Re: Holtz-Eakin-Newey-Rosen example

Posted: Mon Sep 13, 2010 2:21 pm
by TomDoan
cv003h wrote:
TomDoan wrote: This does single equation estimates using 2SLS, 2SLS with heteroscedasticity robust standard errors and joint estimation using 3SLS, all with the Arellano-Bond sets of instruments.
Tom: Do I need to leave in both 2SLS estimates, or do I choose only 1 for my final code? And when I run the code, I get an error stating:

## CP18. ABLAGS is not the Name of a PROCEDURE. (Did you forget to SOURCE?)
>>>>@ablags(<<<<

Any idea what is going wrong? Thanks.
ABLAGS is a standard RATS procedure. If you're running this on Cornell's network, you might want to check where they installed the procedures.

Re: Holtz-Eakin-Newey-Rosen example

Posted: Mon Sep 13, 2010 2:29 pm
by cv003h
TomDoan wrote:ABLAGS is a standard RATS procedure. If you're running this on Cornell's network, you might want to check where they installed the procedures.
I was able to figure this part out, thanks. Now I'm struggling with what to put in the A-B instruments section vs. in the 2SLS section. Why is your capital measure in the AB section but not in the 2SLS section?

Re: Holtz-Eakin-Newey-Rosen example

Posted: Thu Jan 16, 2014 1:16 pm
by TomDoan
cv003h wrote: I was able to figure this part out, thanks. Now I'm struggling with what to put in the A-B instruments section vs. in the 2SLS section. Why is your capital measure in the AB section but not in the 2SLS section?
I think you're asking why it's in the instrument set but not in the model itself. We did that because that was done in the original Gauss program. I'm not sure if this particular example was from a paper that got published. (No one could find the original data set for the Econometrica paper). However, if a variable is seen as being correlated with the "individual effect" but not with the random error, then that variable would be available as an instrument.

The capital measure was taken out of the current version of the program since there is no explanation for why it was there.

Re: Holtz-Eakin-Newey-Rosen example

Posted: Mon May 04, 2015 8:12 am
by levierfr
Dear Tom,

I have a balanced panel dataset, with 22 countries over 22 years and 6 endogenous variables. Thus, my objective is estimate a VAR with 6 variables conditional on current and lagged values of all these 6 variables, contrary to the example given, where the VAR is estimated for two employment variables (part,full) conditional on current and lagged wage variables (pwage,fwage). I am attempting to replicate what is given in the labor.rpf file and accordingly, I have the following questions:

(i) when generating the time-period dummies, I should merely switch out 6 for 20 correct? Also, given the commands that are presented in the labor file:
dec vect[series] pdummy(6)
do i=1,6
set pdummy(i) = %period(t)==i+2
end do i
why do I get a" ## SX21. A END or } Here is Unneeded or Unexpected error" in the output window?

(ii) I am curious as to why there there are " 3 * " behind adfwage and adpwage in the arellano-bond instrument generation:

(iii) Given the variable and VAR description above, to replicate the Holtz-Eakin-Newey Rosen method, I should generate 6 arellano bond instruments, use 6 linregs commands for the 2SLS, 6 linregs for the equation GMM step and then simply group them all in the 3SLS step?

Thanks for your time.

Re: Holtz-Eakin-Newey-Rosen example

Posted: Mon May 04, 2015 11:24 am
by TomDoan
levierfr wrote:Dear Tom,

I have a balanced panel dataset, with 22 countries over 22 years and 6 endogenous variables. Thus, my objective is estimate a VAR with 6 variables conditional on current and lagged values of all these 6 variables, contrary to the example given, where the VAR is estimated for two employment variables (part,full) conditional on current and lagged wage variables (pwage,fwage). I am attempting to
replicate what is given in the labor.rpf file and accordingly, I have the following questions:
That's not going to work. The Holtz-Eakin-Newey-Rosen example has two endogenous variables and two exogenous. The two exogenous (wages) have lagged and current, but the two endogenous just have lags. You can't do a VAR with current values on the right side without some type of structural model to handle those---generally you would just have lags.
levierfr wrote: (i) when generating the time-period dummies, I should merely switch out 6 for 20 correct? Also, given the commands that are presented in the labor file:
dec vect[series] pdummy(6)
do i=1,6
set pdummy(i) = %period(t)==i+2
end do i
why do I get a" ## SX21. A END or } Here is Unneeded or Unexpected error" in the output window?
Correct. You would replace 6 with 20.

Are you doing "Select All" first, or are you trying to run a line at a time? If the latter, you might have tried to do the END DO I twice. (The do loop doesn't produce any visible output).
levierfr wrote: (ii) I am curious as to why there there are " 3 * " behind adfwage and adpwage in the arellano-bond instrument generation:
The first two entries are lost to differencing, so dummies for those become redundant. RATS will detect that and adjust, but it's cleaner to just not add in dummies that aren't necessary.
levierfr wrote: (iii) Given the variable and VAR description above, to replicate the Holtz-Eakin-Newey Rosen method, I should generate 6 arellano bond instruments, use 6 linregs commands for the 2SLS, 6 linregs for the equation GMM step and then simply group them all in the 3SLS step?
Correct.

Re: Holtz-Eakin-Newey-Rosen example

Posted: Mon May 04, 2015 11:58 am
by levierfr
Dear Tom,

Thanks for your response.

My apologies, I meant to write that the 6-variable VAR is estimated only with the lags of the six variables, not the current values.

(i) In this case, would the Holtz-Eakin-Newey-Rosen example be appropriate to replicate and how? Or would I have to use another method to estimate my panel VAR?

(ii) Going on a limb here.. First, difference the variables. Second, generate the arellano bond instruments (skipping time period dummies as I do not want to measure the phenomena in a time-fixed setting), writing the @ablags procedure out just like the endogenous variables of fwage and pwage were in the H-E-N-R example. And, as I outlined in the previous post, continue with using 6 linregs commands for the 2SLS, 6 linregs for the equation GMM step and then simply group them all in the 3SLS step. Lastly, use the 3SLS estimator with GMM weight matrix.

Many thanks again

Re: Holtz-Eakin-Newey-Rosen example

Posted: Mon May 04, 2015 12:23 pm
by TomDoan
levierfr wrote:Dear Tom,

Thanks for your response.

My apologies, I meant to write that the 6-variable VAR is estimated only with the lags of the six variables, not the current values.

(i) In this case, would the Holtz-Eakin-Newey-Rosen example be appropriate to replicate and how? Or would I have to use another method to estimate my panel VAR?
If you want the lag coefficients to be the same across individuals, allowing only for heterogeneity in the intercepts, then this would be the technique that you would want.
levierfr wrote: (ii) Going on a limb here.. First, difference the variables. Second, generate the arellano bond instruments (skipping time period dummies as I do not want to measure the phenomena in a time-fixed setting), writing the @ablags procedure out just like the endogenous variables of fwage and pwage were in the H-E-N-R example. And, as I outlined in the previous post, continue with using 6 linregs commands for the 2SLS, 6 linregs for the equation GMM step and then simply group them all in the 3SLS step. Lastly, use the 3SLS estimator with GMM weight matrix.

Many thanks again
That sounds correct.

Re: Holtz-Eakin-Newey-Rosen example

Posted: Tue May 05, 2015 5:22 am
by levierfr
Tom,

Thanks for your reply. I believe that this is my final doubt: In completing the 3SLS step, after I have grouped my six equations in to the 'pvar', I ran the command sur(model=pvar,inst,zudep,update=continuous) and got the following error: ## REG21. Can't Freely Estimate SW Matrix with 1440 Conditions. Have Only 440 Observations.

I thought that either (i) I do not have enough observations to run the panel VAR or (ii) something should be altered in the SUR instruction (which I cannot locate) or (iii) more likely that the source of the error perhaps lies in the fact that my dataset in the format type A, and that this would require me to use the pregress instruction with method=sur to obtain the same command as above. What should the command look like? The PRegress instruction for RATS v8.1 outlines the following: "You must set your instruments list first using the instruction INSTRUMENTS (which I have done). This can be used with any of the METHOD options except SUR."

I would not know how to proceed from here. Would you recommend any course of action?

Best regards

Re: Holtz-Eakin-Newey-Rosen example

Posted: Tue May 05, 2015 11:34 am
by TomDoan
You have a very different type of data set than H-ENR. They had big N, (very) small T; you have medium N, medium T. The problem comes with the medium T and the construction of the Arellano-Bond instruments. This already is doing less than the complete set of A-B instruments since it restricts the maximum lag---a complete set has an instrument for each lag and for each time period which quickly gets to be enormous when T is bigger than 10. Even that's too many in this case because N isn't large. A feasible optimal GMM estimator has to have at least as many data points as orthogonality conditions (and should generally have quite a few more). You have 440 observations, and 6 (residuals) x 6 (variables that need instruments) x 20 data points x 2(?) lags orthogonality conditions. When you have a situation like this, you can cut down further on the number of A-B instruments by using the COLLAPSE option on @ABLAGS---instead of one instrument per time period per lag, it has just one per lag (which is the "normal" way to handle instruments in, for instance, macro models). If you use COLLAPSE, you probably want to increase the number of instrumenting lags; MINLAG=2,MAXLAG=5,COLLAPSE looks like it would give about the right number of orthogonality conditions. (Note that you don't have a problem with the single equation estimates because they don't have that extra 6 x on the front.)

Re: Holtz-Eakin-Newey-Rosen example

Posted: Wed May 06, 2015 5:01 am
by levierfr
Tom,

First off, thanks so much for all your help.

I believe you may have mistaken COMPRESS for COLLAPSE, as compress does not appear on an options on the ablags.src procedure file.

Using collapse, everything worked smoothly until the last step (3SLS with GMM weight matrix). It presents the following message: ## REG13. Singular Regressions - Check for Collinearity among Rows 1 to 8.

Please find the code and datafile below for your reference.

calendar(panelobs=22,a) 1990
all 22//2011:01
OPEN DATA "/Users/frank/Desktop/datafile_final.xlsx"
CALENDAR(PANELOBS=22,A) 1990:1
DATA(FORMAT=XLSX,ORG=COLUMNS) 1//1990:01 22//2011:01 merg gf gdp fmd hc infl
print
set dmerg = merg-merg{1}
set dgf = gf-gf{1}
set dgdp = gdp-gdp{1}
set dfmd = fmd-fmd{1}
set dhc = hc-hc{1}
set dinfl = infl-infl{1}
@ablags(minlag=2,maxlag=5,collapse) merg abmerg
@ablags(minlag=2,maxlag=5,collapse) gf abgf
@ablags(minlag=2,maxlag=5,collapse) gdp abgdp
@ablags(minlag=2,maxlag=5,collapse) fmd abfmd
@ablags(minlag=2,maxlag=5,collapse) hc abhc
@ablags(minlag=2,maxlag=5,collapse) infl abinfl
instruments abmerg abgf abgdp abfmd abhc abinfl
linreg(inst,define=mergeq) dmerg
# dmerg{1} dgf{1} dgdp{1} dfmd{1} dhc{1} dinfl{1}
linreg(inst,define=gfeq) dgf
# dmerg{1} dgf{1} dgdp{1} dfmd{1} dhc{1} dinfl{1}
linreg(inst,define=gdpeq) dgdp
# dmerg{1} dgf{1} dgdp{1} dfmd{1} dhc{1} dinfl{1}
linreg(inst,define=fmdeq) dfmd
# dmerg{1} dgf{1} dgdp{1} dfmd{1} dhc{1} dinfl{1}
linreg(inst,define=hceq) dhc
# dmerg{1} dgf{1} dgdp{1} dfmd{1} dhc{1} dinfl{1}
linreg(inst,define=infleq) dinfl
# dmerg{1} dgf{1} dgdp{1} dfmd{1} dhc{1} dinfl{1}
linreg(inst,equation=mergeq,optimal,lwindow=panel)
linreg(inst,equation=gfeq,optimal,lwindow=panel)
linreg(inst,equation=gdpeq,optimal,lwindow=panel)
linreg(inst,equation=fmdeq,optimal,lwindow=panel)
linreg(inst,equation=hceq,optimal,lwindow=panel)
linreg(inst,equation=infleq,optimal,lwindow=panel)
group pvar mergeq gfeq gdpeq fmdeq hceq infleq
sur(model=pvar,inst,zudep,update=continuous)
sur(model=pvar,inst,zudep,update=continuous,lwindow=panel) - this step presents the error

Re: Holtz-Eakin-Newey-Rosen example

Posted: Wed May 06, 2015 7:44 am
by TomDoan
Thanks. I corrected the error with COLLAPSE above.

LWINDOW=PANEL simply won't work with your "shape" data set---it requires N to be quite a bit bigger than T as it tries to freely estimate a full T x T covariance matrix by summing across N.

Re: Holtz-Eakin-Newey-Rosen example

Posted: Wed May 06, 2015 9:16 am
by levierfr
Tom,

No worries, we are all in the same boat here.

So let me get this straight: I obtain the first difference of the endogenous variables to get rid of the individual effects and essentially to use all the past information of Y(i,t) as instruments, which I do in the ablags step (restricting the max. no, of lags). Then I run a regression using these instrumental variable, then later use the GMM to estimate these regressions in a panel setting (hence the lwindow=panel). By then grouping these six linreg lines of code, I essentially replicate the VAR in a panel setting, and by running the SUR on it I get the covariance/correlation matrix of residuals. From here can I directly generate the appropriate IRFs and FEVDs using the IMPULSE and ERRORS commands? The steps should equal 5 (i.e. the max. lag) or 10 (given in textbooks).