Dear all,
I am starting my Ph.D and have some problems with a model, I hope you can help me. I am using an unbalance panel of 8 year to estimate the % of sales due to product innovation (Y2) (in logs) as a function of X1 (main variable in the analysis) and some firm characteristics say (Zi1). I am aware of a presence of selection due to that I can only observe Y2 (non-zero values) if the firm is product innovator (Y1) which is a dummy. I am trying to correct using a Heckman process as in Wooldridge, 1995. First I have to do a yearly probit of Y1=(X1, Zi, acti2d3-acti2d50) where Zi contains Zi1 plus some exclusion restrictions and acti2d3-acti2d50 are sectoral dummies, obtaining the yearly inverse Mill ratios. Then I need to put those ratios in the second step regression of Y2=(X1, Zi1, lambdas, acti2d3-acti2d50, i.time) only for the selected sample, say only for Y1==1, when all the explicative are lagged one period for avoiding simultaneity in both equations. As I am doing this process in two step the standard error must be corrected using boostrap errors. My problem is that the program I created does not work. I have been looking for others posts here in statalist with problems pretty similar to mine, for example: http://www.statalist.org/forums/foru...tandard-errors
and I have tried to do what I read on those post, but still the error is there. I have 8 year, but only show you the program for two of them because of space. The program is the following:
program drop myols
program myols, eclass
version 13
syntax varlist [if] [in] [, Robust noCONStant ]
gettoken y xvar : varlist
display "varlist contains: " "`varlist´"
display "and if contains: " "`ìf´"
display "and in contains: " "`ìn´"
display "and y contains: " "`y´"
display "and xvars contains: " "`xvars´"
probit Y1 X1 Zi acti2d3-acti2d50 if time==2005 /* selection equation */
predict acltxb1_2005, xb
gen lambda05=normalden(acltxb1_2005)/normprob(acltxb1_2005)
probit Y1 X1 Zi acti2d3-acti2d50 if time==2006 /* selection equation */
predict acltxb1_2006, xb
gen lambda06=normalden(acltxb1_2006)/normprob(acltxb1_2006)
reg Y2 X1 Zi1 lambda05 lambda06 acti2d3-acti2d50 i.time if Y1==1
drop acltxb1_2005 lambda05 acltxb1_2006 lambda06
end
bootstrap _b, rep(500) seed(10101): myols X1 Zi1
It gives me the following error: insufficient observations to compute bootstrap standard errors
no results will be saved.
If I put the option (noisily) in the bootstrap command then it gives me the following error:
outcome does not vary; remember:
0 = negative outcome,
all other nonmissing values = positive outcome
an error occurred when bootstrap executed myols, posting missing values. insufficient observations to compute bootstrap standard errors no results will be saved
I also tried putting the cluster options for panels, when ident is my identificator:
generate newid = ident
tsset newid time
generate sample=1-missing(Y2,Y1,X1,Zi,acti2d2-acti2d50)
keep if sample
bootstrap _b, rep(500) seed(10101) cluster(ident) idcluster(newid) nowarn: myols X1 Zi1
insufficient observations to compute bootstrap standard errors no results will be saved
I have tried without the (if Y1==1) and also without the sectoral dummies in the main regression (Y2) and then it compute the bootstrap, but the methodology says that the second equation must be for the selected sample (Y1==1) (as in the post I have referenced at the beginning).
Any hint or help will be more than welcome.
Thanks in advance.
pd. sorry for the long post.
I am starting my Ph.D and have some problems with a model, I hope you can help me. I am using an unbalance panel of 8 year to estimate the % of sales due to product innovation (Y2) (in logs) as a function of X1 (main variable in the analysis) and some firm characteristics say (Zi1). I am aware of a presence of selection due to that I can only observe Y2 (non-zero values) if the firm is product innovator (Y1) which is a dummy. I am trying to correct using a Heckman process as in Wooldridge, 1995. First I have to do a yearly probit of Y1=(X1, Zi, acti2d3-acti2d50) where Zi contains Zi1 plus some exclusion restrictions and acti2d3-acti2d50 are sectoral dummies, obtaining the yearly inverse Mill ratios. Then I need to put those ratios in the second step regression of Y2=(X1, Zi1, lambdas, acti2d3-acti2d50, i.time) only for the selected sample, say only for Y1==1, when all the explicative are lagged one period for avoiding simultaneity in both equations. As I am doing this process in two step the standard error must be corrected using boostrap errors. My problem is that the program I created does not work. I have been looking for others posts here in statalist with problems pretty similar to mine, for example: http://www.statalist.org/forums/foru...tandard-errors
and I have tried to do what I read on those post, but still the error is there. I have 8 year, but only show you the program for two of them because of space. The program is the following:
program drop myols
program myols, eclass
version 13
syntax varlist [if] [in] [, Robust noCONStant ]
gettoken y xvar : varlist
display "varlist contains: " "`varlist´"
display "and if contains: " "`ìf´"
display "and in contains: " "`ìn´"
display "and y contains: " "`y´"
display "and xvars contains: " "`xvars´"
probit Y1 X1 Zi acti2d3-acti2d50 if time==2005 /* selection equation */
predict acltxb1_2005, xb
gen lambda05=normalden(acltxb1_2005)/normprob(acltxb1_2005)
probit Y1 X1 Zi acti2d3-acti2d50 if time==2006 /* selection equation */
predict acltxb1_2006, xb
gen lambda06=normalden(acltxb1_2006)/normprob(acltxb1_2006)
reg Y2 X1 Zi1 lambda05 lambda06 acti2d3-acti2d50 i.time if Y1==1
drop acltxb1_2005 lambda05 acltxb1_2006 lambda06
end
bootstrap _b, rep(500) seed(10101): myols X1 Zi1
It gives me the following error: insufficient observations to compute bootstrap standard errors
no results will be saved.
If I put the option (noisily) in the bootstrap command then it gives me the following error:
outcome does not vary; remember:
0 = negative outcome,
all other nonmissing values = positive outcome
an error occurred when bootstrap executed myols, posting missing values. insufficient observations to compute bootstrap standard errors no results will be saved
I also tried putting the cluster options for panels, when ident is my identificator:
generate newid = ident
tsset newid time
generate sample=1-missing(Y2,Y1,X1,Zi,acti2d2-acti2d50)
keep if sample
bootstrap _b, rep(500) seed(10101) cluster(ident) idcluster(newid) nowarn: myols X1 Zi1
insufficient observations to compute bootstrap standard errors no results will be saved
I have tried without the (if Y1==1) and also without the sectoral dummies in the main regression (Y2) and then it compute the bootstrap, but the methodology says that the second equation must be for the selected sample (Y1==1) (as in the post I have referenced at the beginning).
Any hint or help will be more than welcome.
Thanks in advance.
pd. sorry for the long post.