Dear all,
I want to estimate a model with IV 2SLS method. I divide the sample into two subsamples: male and female, and estimate two models on these two subsamples separately. But then I want to test whether all the coefficients in the two models based on the two subsamples are the same, i.e. whether I can just estimate the model using the combined sample of males and females. Could anybody tell me how to realize this test? Many thanks, Sharon |
Dear all,
To be more specific, the codes I use are: ivreg2 y x1 x2 (x3 x4=z1 z2 z3) if male==1 estimates store f1 ivreg2 y x1 x2 (x3 x4=z1 z2 z3) if male==0 estimates store f0 suest f1 f0, cluster(mm) and I got the error message as: unable to generate scores for model f1 suest requires that predict allow the score option Here, y is the dependent variable, x1-x4 are covariates while x3 and x4 are endogenous, and z1-z3 are instruments. I want to test whether the coefficients of x1-x4 are the same in the two models based on male and female subsamples. And I need to use IV 2SLS method. So could anybody help me? I would really appreciate your help. Sharon |
Stacking might help:
http://statalist.1588530.n2.nabble.com/st-Compare-ivreg-coefficients-across-models-td4077316.html Sascha On 16 Aug 2010, at 16:16, xueliansharon wrote: > Dear all, > > To be more specific, the codes I use are: > > ivreg2 y x1 x2 (x3 x4=z1 z2 z3) if male==1 > estimates store f1 > ivreg2 y x1 x2 (x3 x4=z1 z2 z3) if male==0 > estimates store f0 > suest f1 f0, cluster(mm) > > and I got the error message as: > unable to generate scores for model f1 > suest requires that predict allow the score option > > Here, y is the dependent variable, x1-x4 are covariates while x3 and > x4 are > endogenous, and z1-z3 are instruments. I want to test whether the > coefficients of x1-x4 are the same in the two models based on male and > female subsamples. And I need to use IV 2SLS method. So could > anybody help > me? > > I would really appreciate your help. > > Sharon > -- > View this message in context: http://statalist.1588530.n2.nabble.com/test-of-the-equality-of-coefficients-in-two-models-tp5427850p5428022.html > Sent from the Statalist mailing list archive at Nabble.com. > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Hi, Sascha,
Thanks for your reference. Yes, I already read this file, but the problem is that I need to allow for clustering on variable mm, but the method described in the http://statalist.1588530.n2.nabble.com/st-Compare-ivreg-coefficients-across-models-td4077316.html doesn't allow for clustering on another variable mm, since it's already clustering on idcode. So is there anyway to allow for clustering on my variable mm? Thanks, Sharon Re: test of the equality of coefficients in two models Aug 16, 2010; 06:38pm — by Sascha Heller Stacking might help: http://statalist.1588530.n2.nabble.com/st-Compare-ivreg-coefficients-across-models-td4077316.html Sascha |
Maybe I don't understand your question exactly, but for the STATA
example (given in the link), it work's fine when clustering for any other variable (hours etc.) and the SEs change. Does that answer your question? If not, please give further info. Sascha On 17 Aug 2010, at 00:51, xueliansharon wrote: > Hi, Sascha, > > Thanks for your reference. Yes, I already read this file, but the > problem is > that I need to allow for clustering on variable mm, but the method > described > in the > http://statalist.1588530.n2.nabble.com/st-Compare-ivreg-coefficients-across-models-td4077316.html > doesn't allow for clustering on another variable mm, since it's > already > clustering on idcode. > > So is there anyway to allow for clustering on my variable mm? > > Thanks, > Sharon > > > > > > Re: test of the equality of coefficients in two models > Aug 16, 2010; 06:38pm — by Sascha Heller > Stacking might help: > > http://statalist.1588530.n2.nabble.com/st-Compare-ivreg-coefficients-across-models-td4077316.html > > Sascha > -- > View this message in context: http://statalist.1588530.n2.nabble.com/test-of-the-equality-of-coefficients-in-two-models-tp5427850p5429948.html > Sent from the Statalist mailing list archive at Nabble.com. > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Hi, Sascha,
OK, take the stata example from the link as an example, if what I want to replicate using the stacking process is: est clear sysuse nlsw88, clear reg wage hours if south est sto south reg wage hours if smsa est sto smsa suest south smsa, cluster(hours) How to realize clustering on "hours" in the stacking process? just use "reg wage hours? n, cl(hours)" ? But I think we also need to cluster on "idcode" to make the stacking process equivalent to the -suest- command. So what should I do to use the stacking process to get the outcome of "suest south smsa, cluster(hours)"? Many thanks, Sharon Re: test of the equality of coefficients in two models Aug 17, 2010; 04:07am — by Sascha Heller Maybe I don't understand your question exactly, but for the STATA example (given in the link), it work's fine when clustering for any other variable (hours etc.) and the SEs change. Does that answer your question? If not, please give further info. Sascha |
In reply to this post by Sascha Heller
Related to Sharon's question, I have a similar problem, where I want to estimate the covariance between estimated regression coefficients obtained under clustering, but for two different indicator variables with the same predictors:
. qui xtlogit Iy x1 x2 if q==5,i(isub) nolog . est store q5 . qui xtlogit Iy x1 x2 if q==6,i(isub) nolog . est store q6 . suest q5 q6 unable to generate scores for model q5 suest requires that predict allow the score option r(322); This works with estimation using -logit-, but then I can't allow for the clustering. So how would -stack- help here? Al Feiveson -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Sascha Heller Sent: Tuesday, August 17, 2010 3:07 AM To: [hidden email] Cc: Sascha Heller Subject: Re: st: Re: test of the equality of coefficients in two models Maybe I don't understand your question exactly, but for the STATA example (given in the link), it work's fine when clustering for any other variable (hours etc.) and the SEs change. Does that answer your question? If not, please give further info. Sascha On 17 Aug 2010, at 00:51, xueliansharon wrote: > Hi, Sascha, > > Thanks for your reference. Yes, I already read this file, but the > problem is > that I need to allow for clustering on variable mm, but the method > described > in the > http://statalist.1588530.n2.nabble.com/st-Compare-ivreg-coefficients-across-models-td4077316.html > doesn't allow for clustering on another variable mm, since it's > already > clustering on idcode. > > So is there anyway to allow for clustering on my variable mm? > > Thanks, > Sharon > > > > > > Re: test of the equality of coefficients in two models > Aug 16, 2010; 06:38pm - by Sascha Heller > Stacking might help: > > http://statalist.1588530.n2.nabble.com/st-Compare-ivreg-coefficients-across-models-td4077316.html > > Sascha > -- > View this message in context: http://statalist.1588530.n2.nabble.com/test-of-the-equality-of-coefficients-in-two-models-tp5427850p5429948.html > Sent from the Statalist mailing list archive at Nabble.com. > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
In reply to this post by xueliansharon
Dear Sharon,
I do not know the IV 2SLS method, but in OLS regression the solution would be to merge both subsamples and run analysis with interaction terms gender*variable of interest. If the interaction term were non significant there would not be evidence of differences between the estimates for both sexes. HTH. Angel Rodriguez Laso 2010/8/16 xueliansharon <[hidden email]>: > Dear all, > > I want to estimate a model with IV 2SLS method. I divide the sample into two > subsamples: male and female, and estimate two models on these two subsamples > separately. But then I want to test whether all the coefficients in the two > models based on the two subsamples are the same, i.e. whether I can just > estimate the model using the combined sample of males and females. Could > anybody tell me how to realize this test? > > > Many thanks, > Sharon > -- > View this message in context: http://statalist.1588530.n2.nabble.com/test-of-the-equality-of-coefficients-in-two-models-tp5427850p5427850.html > Sent from the Statalist mailing list archive at Nabble.com. > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
In reply to this post by xueliansharon
Okay, understood. cl(idcode hours) obviously won't work.
Just providing an idea: use reg3 (with an 2sls command) instead of ivregress. You then might estimate a stacked model with one equation for "male" and "female" each for the endogenous explanatory variable where you should be able to cluster for your specified variable in each equation. Testing is then no problem anymore. I hope that help's. Sascha On 17 Aug 2010, at 15:26, xueliansharon wrote: > Hi, Sascha, > > OK, take the stata example from the link as an example, if what I > want to > replicate using the stacking process is: > > est clear > sysuse nlsw88, clear > reg wage hours if south > est sto south > reg wage hours if smsa > est sto smsa > suest south smsa, cluster(hours) > > How to realize clustering on "hours" in the stacking process? just > use "reg > wage hours? n, cl(hours)" ? But I think we also need to cluster on > "idcode" > to make the stacking process equivalent to the -suest- command. So > what > should I do to use the stacking process to get the outcome of "suest > south > smsa, cluster(hours)"? > > Many thanks, > Sharon > > > > > > > Re: test of the equality of coefficients in two models > Aug 17, 2010; 04:07am — by Sascha Heller > Maybe I don't understand your question exactly, but for the STATA > example (given in the link), it work's fine when clustering for any > other variable (hours etc.) and the SEs change. > > Does that answer your question? If not, please give further info. > > Sascha > -- > View this message in context: http://statalist.1588530.n2.nabble.com/test-of-the-equality-of-coefficients-in-two-models-tp5427850p5432075.html > Sent from the Statalist mailing list archive at Nabble.com. > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Sharon, Sascha,
It depends on whether Sharon wants to cluster on one or two variables. -suest- lets you cluster on one variable, and the code Austin Nichols posted last year in http://www.stata.com/statalist/archive/2009-11/msg01485.html shows how to replicate this by stacking (with minor differences in the SEs because of differences in dof adjustments). -ivreg-, -ivreg2- and -ivregress- don't produce scores so -suest- won't work but stacking does. All straightforward if Sharon wants to cluster on one variable. But it looks like Sharon wants to cluster on two variables. Now if one variable is nested in the other, it's still easy - just cluster on the "larger" one. For example, if the data were on individuals and you wanted to cluster on individual and household, then clustering on household is enough (assuming there are no individuals who change household). If the two variables aren't nested, then you can still cluster on both using 2-way clustering of Cameron-Gelbach-Miller/Thompson. This is supported in the latest version of -ivreg2-, and is discussed in the -ivreg2- help file and in the Stata user group presentation by Baum-Nichols-Schaffer. The latter is available at http://ideas.repec.org/p/boc/bost10/11.html. I am pretty sure that the only thing you need to do to implement this is to use Austin's code and just change the stacked estimation so that it calls -ivreg2- with 2-way clustering, e.g., ivreg2 wage (hours=ten union) n, cl(idcode hours) Cheers, Mark > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of > Sascha Heller > Sent: 17 August 2010 23:41 > To: [hidden email] > Cc: Sascha Heller > Subject: Re: st: Re: test of the equality of coefficients in > two models > > Okay, understood. cl(idcode hours) obviously won't work. > > Just providing an idea: use reg3 (with an 2sls command) > instead of ivregress. You then might estimate a stacked model > with one equation for "male" and "female" each for the > endogenous explanatory variable where you should be able to > cluster for your specified variable in each equation. Testing > is then no problem anymore. I hope that help's. > > Sascha > > On 17 Aug 2010, at 15:26, xueliansharon wrote: > > > Hi, Sascha, > > > > OK, take the stata example from the link as an example, if > what I want > > to replicate using the stacking process is: > > > > est clear > > sysuse nlsw88, clear > > reg wage hours if south > > est sto south > > reg wage hours if smsa > > est sto smsa > > suest south smsa, cluster(hours) > > > > How to realize clustering on "hours" in the stacking > process? just use > > "reg wage hours? n, cl(hours)" ? But I think we also need > to cluster > > on "idcode" > > to make the stacking process equivalent to the -suest- command. So > > what should I do to use the stacking process to get the outcome of > > "suest south smsa, cluster(hours)"? > > > > Many thanks, > > Sharon > > > > > > > > > > > > > > Re: test of the equality of coefficients in two models > > Aug 17, 2010; 04:07am - by Sascha Heller > > Maybe I don't understand your question exactly, but for the STATA > > example (given in the link), it work's fine when clustering for any > > other variable (hours etc.) and the SEs change. > > > > Does that answer your question? If not, please give further info. > > > > Sascha > > -- > > View this message in context: > > > http://statalist.1588530.n2.nabble.com/test-of-the-equality-of-coeffic > > ients-in-two-models-tp5427850p5432075.html > > Sent from the Statalist mailing list archive at Nabble.com. > > > > * > > * For searches and help try: > > * http://www.stata.com/help.cgi?search > > * http://www.stata.com/support/statalist/faq > > * http://www.ats.ucla.edu/stat/stata/ > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > -- Heriot-Watt University is a Scottish charity registered under charity number SC000278. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Sascha and Mark ,
Understand. Thanks a lot for all your helps! I can implement the clustering right now. Sharon |
Free forum by Nabble | Edit this page |