Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Frank Barbera <fbarbera@bond.edu.au> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
st: How to perform a Wald test between the fixed effect (clarification)... |

Date |
Tue, 26 Feb 2013 17:38:26 +1000 |

Dear stata users, I've been trying to solve this problem from days now and still have not figured it out. I've also had no luck with receiving a response to my previous question, but perhaps it's due to a lack of clarity on my part. To reiterate my problem... Working with the following variables in a panel.... id = unique identifier time = time period (from 1-3) Yit = some dependent variable for firm i in time t Xit = some independent variable for firm i in time t ffi = a time invariant dummy equating to 1 if firm i is in the 'ff group' and 0 otherwise ffid = id*ff nfid = id*(1-ff) With these I run the following fixed effect model, which also generates the individual intercept coefficient for each firm. These coefficients are automatically labelled as _Iidff_i for the ff group and _Iidnf_i for the nf group... xi: regress y x i.ffid i.nfid, noconstant After this regression, I simply want to perform an F-test which tests the restriction that the average _Iidff_ is equal to the average _Iidnf_. In a smaller data set I can do this, quite awkwardly, by manually typing the following test (where say there are 10 firms, the first 6 being ff and the last 4 being nf)... test (_Iidff_1+Iidff_2+ Iidff_3+ Iidff_4+ _Iidff_5+_Iidff_6)/6=(_Iidnf_1+Iidnf_2+ Iidnf_3+ Iidnf_4)/4 but the problem I have is that there are over 3000 individual firms in my sample and there is no way to manually type out the test (I've tried, and got the 'expression too long' error). I've seen suggestions online pertaining to doing a loop with -append-, but I still haven't been able to replicate such commands in this case. Can anyone help? Frank -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Frank Barbera Sent: Friday, 22 February 2013 3:46 PM To: statalist@hsphsun2.harvard.edu Subject: RE: st: RE: How to perform a Wald test between the fixed effect... {POSSIBLY FORGED EMAIL} Hi John, thanks for your response. To be clear, I don't think there is anything wrong with what you have shown me and I appreciate your advice. With that said, in addition to the approach you outlined, I still wish to perform the Wald test in the manner I have explained (which also tests the time invariant predictor, but in a different way). My apologies for not being as clear as possible before, but my question is... Regardless of the existence of other approaches which are similar, can you (or anyone else) help me shorten the code in the Wald test. I would simply need to know which command would allow me to average the estimated coefficient for each group. In the example I gave you, there were 9 firms, each belonging to race 1 or 2. I wish to test if the average estimated effect of all race 1 individuals is equivalent to the average estimated effect of all race 2 individuals without having to type it all out (since I have over 3000 individuals). For example, as per my last message, is there a faster way to perform the following Wald test without typing out all the coefficient names? test (_Iid_race1_4+_Iid_race1_5+_Iid_race1_6+_Iid_race1_7+_Iid_race1_9+_Iid _race1_10)/6 = (_Iid_race2_1+_Iid_race2_2+_Iid_race2_3)/3 Best, Frank -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of John Antonakis Sent: Friday, 22 February 2013 2:20 AM To: statalist@hsphsun2.harvard.edu Subject: Re: st: RE: How to perform a Wald test between the fixed effect... I can't see why you are doing what you are doing. What is wrong with what I showed you? You said that you "wish to test the whether the time invariant predictor was significant" and based on your earlier message, you said that you wanted to use a random-effects estimator AND ensure that it was consistent. You said that if you did a fixed-effects model that it would kick out the time invariant predictor. So, I showed you how to have consistent random effects estimator (included time invariant predictors). I don't know what more I can say. Best, J. __________________________________________ John Antonakis Professor of Organizational Behavior Director, Ph.D. Program in Management Faculty of Business and Economics University of Lausanne Internef #618 CH-1015 Lausanne-Dorigny Switzerland Tel ++41 (0)21 692-3438 Fax ++41 (0)21 692-3305 http://www.hec.unil.ch/people/jantonakis Associate Editor The Leadership Quarterly __________________________________________ On 21.02.2013 13:12, Frank Barbera wrote: > Hi John, you are correct, I wish to test the whether the time invariant predictor was significant, but not via the Mundlak or RE approach. > > I can't show you what I mean with all the data in 'nlswork' since there are too many idcodes, but if we can focus on the first 9 individuals (up to idcode 10, as idcode 8 is missing), I'll try to explain. Please bear with my clumsy commands (this is all new to me). > > First, I create a 'race_1' dummy equating to 1 if the individual is of the first race and 0 if they belong to the second... > > gen race_1=0 > replace race_1 = 1 if race < 2 > > Then I categorise the idcodes into race_1 or race_2... > > generate id_race1 = idcode*race_1 > generate id_race2 = idcode*(1-race_1) > > After that, I run the following regression, which creates the individual dummies and estimates each individuals intercept coefficient (wherein race has been absorbed)... > > xi: regress ln_w age i.id_race1 i.id_race2, noconstant > > From this I can simply see that the average fixed effect for those of race 1 is 1.34, while the average fixed effect for those of race 2 is 1.37. > > Finally, to test if these values are significantly different, I perform the following Wald test, which tests if the average fixed effect for race 1 (in this case across 6 individuals) is equivalent to the average fixed effect for race 2 (in this case across 3 individuals)... > > test > (_Iid_race1_4+_Iid_race1_5+_Iid_race1_6+_Iid_race1_7+_Iid_race1_9+_Iid > _race1_10)/6 = (_Iid_race2_1+_Iid_race2_2+_Iid_race2_3)/3 > > This yields the following, non-rejection of the null... > > F( 1, 96) = 0.29 > Prob > F = 0.5940 > > What do you think? The notion here is that the estimates are unbiased relative to the RE model (in this case the Hausman does not reject the null, so it doesn't really matter, but my data are another story ). I realise that my commands are completely inefficient and I'd really appreciate any advice with that. > > The main issue I have now is how to perform the Wald test in the final step with 3450 dummies without having to type it all out? > > Thanks, Frank > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of John > Antonakis > Sent: Thursday, 21 February 2013 7:03 PM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: RE: How to perform a Wald test between the fixed effect... > > Hi Frank. > > Can you use the nlswork dataset shipped with Stata and work with the > example I gave you? I am not sure what it is you want to do any more. > I thought you wanted to see whether a time invariant predictor was > significant. That is the test that the estimate (in my example of > race) is not equal to zero....that is the test you want which for 1 > parameter is equal to a Wald test, e.g., by using -test race- > > eg.., > > clear > webuse nlswork > xtset idcode > xtreg ln_w race age , fe r > bys idcode: egen mean_race = mean(race) xtreg ln_w race age , re r > test race > dis sqrt(r(chi2)) > > Which equals the z value, 7.37, from the model. > > Best, > J. > > __________________________________________ > > John Antonakis > Professor of Organizational Behavior > Director, Ph.D. Program in Management > > Faculty of Business and Economics > University of Lausanne > Internef #618 > CH-1015 Lausanne-Dorigny > Switzerland > Tel ++41 (0)21 692-3438 > Fax ++41 (0)21 692-3305 > http://www.hec.unil.ch/people/jantonakis > > Associate Editor > The Leadership Quarterly > __________________________________________ > > On 21.02.2013 08:29, Frank Barbera wrote: > > First off, I'd like to thank Dave and John for their responses. > > > > John, your work on this issue has been very helpful in particular. > And (when there's time) I'll be sure to read the Allison book which Dave has mentioned. With that said, I have already considered Mundlak's approach, but the issue of performing the Wald test within the fixed set-up remains (as this will be compared to the random and Mundlak estimates). > > > > With respect to my previous message, I've been playing with a toy dataset and noticed that if I -generate- the following id variables... > > > > generate ffid = id*ff > > > > generate nfid = id*(1-ff) > > > > which separates the id into two groups (ff and nf). To estimate the ai's... > > > > xi: regress y x i.ffid i.nfid, noconstant > > > > which, unbeknownst to me, creates a dummy for each firm (coded as _Iffid_i, where i = {1...10} in my toy dataset. The fist 5 blong to ff while the last 5 belong to nf). Then for the restriction, Wald test of the average ai ff = average ai nf by... > > > > test ( _Iffid_1+_Iffid_2+ _Iffid_3+_Iffid_4+ _Iffid_5)/5 = > (_Infid_6+ _Infid_7+_Infid_8+_Infid_9+_Infid_10)/5 > > > > F( 1, 9) = 0.38 > > Prob > F = 0.5532 > > > > which seems to have worked (albiet there is no ff effect). Can anyone confirm if this procedure is correct? If so, how to do the final step for 3450 dummies? > > > > Sorry for the basic questions, but I'm completely new to Stata. > > > > Frank Barbera > > > > -----Original Message----- > > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of John Antonakis > Sent: Thursday, 21 February 2013 3:20 AM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: RE: How to perform a Wald test between the fixed effect... > > > > Hi Frank: > > > > See the following, with the basic explanations about the Mundlak > procedure: > > > > Antonakis, J., Bendahan, S., Jacquart, P., & Lalive, R. (2010). On making causal claims: A review and recommendations. The Leadership Quarterly, 21(6). 1086-1120. > > http://www.hec.unil.ch/jantonakis/Causal_Claims.pdf > > (refer to the paper by Mundlak for technical explanations) > > Try this (suppose you want to test for race): > > > > clear > > webuse nlswork > > xtset idcode > > xtreg ln_w race age , fe r > > est store fe > > > > *notice race gets kicked out > > > > bys idcode: egen mean_race = mean(race) > > xtreg ln_w race age , re r > est store re > > est tab fe re, se t > > So, you can have your cake an eat it too. A fixed-effects estimator with time-invariant predictors. > > > > So, basically, if you include the cluster means of all time-varying variables, and assuming that ff is exogenous, then you can interpret the coefficient of ff. > > > > HTH, > > J. > > > > __________________________________________ > > > > John Antonakis > > Professor of Organizational Behavior > > Director, Ph.D. Program in Management > > Faculty of Business and Economics > University of Lausanne > Internef #618 > CH-1015 Lausanne-Dorigny > Switzerland > Tel ++41 (0)21 692-3438 > Fax ++41 (0)21 692-3305 > http://www.hec.unil.ch/people/jantonakis > > > > Associate Editor > > The Leadership Quarterly > > __________________________________________ > > > > On 20.02.2013 17:57, Jacobs, David wrote: > >> You might find Paul Allison's book in the paperback Sage series on methods (it has fixed-effects in the title) to be quite useful. In it Allison outlines a way to estimate time-variant explanatory variables with fixed-effects combined with (or included in the same model) a random-effects estimate of one or more time-invariant explanatory variables. Of course, the estimate of the coefficient on the time-invariant explanatory variable may suffer from omitted variable disturbances due to the absence of the automatic controls in the non-fixed-effects estimate, but a solution like this may be your only choice. > >> > >> I understand that I am not answering your exact question, but this quite different approach may nevertheless suffice. > >> > >> Dave Jacobs > >> > >> -----Original Message----- > >> From: owner-statalist@hsphsun2.harvard.edu > >> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Frank >> Barbera >> Sent: Wednesday, February 20, 2013 4:59 AM >> To: statalist@hsphsun2.harvard.edu >> Subject: st: How to perform a Wald test between the fixed effect... > >> > >> Dear Stata users, I'm attempting to perform what appears to be a >> relatively simple procedure in Sata, but due to my lack of experience >> with the program, I'm having a really hard time. I'm using a panel to >> estimate a the following standard fixed effects model >> > >> (1) yit = ai + bxit + eit. > >> > >> Where i are individual firms (3450 firms, coded as 'id') and t is time >> (3 years, coded as 'time'). Each firm can further be classified as >> belonging to a group (called 'ff') or not (I'll call these 'not ff'). > >> This is done by way of a dummy variable equating to 1 if the firm > is >> in the ff group and 0 otherwise. The problem is that ff is time > >> invariant, so its effect cannot be directly estimated in the model > >> (it's been absorbed into ai). Of course a random effect > specification >> would allow me to observe the ff effect on y, but > the data violate the >> assumption of no correlation between the > unique errors and the >> regressors, so the fixed effect model is > preferred. I took a closer >> look at the estimates for ai by way of > the following command >> >> regress y x i.id, noconstant >> >> and > simply compared the average ai for firms in the ff category with those > in the not ff category. I now wish to officially test if the average > ai (for ff firms) = average ai (for not ff firms), or in other words > if the ff effect is significant. A Wald coefficient test with the > restriction that average ai (for ff firms) - average ai (for not ff > firms) = 0 should do it, but since I estimated (1) using the i.id option, I have no idea how to do this within (1). i.e. I do not wish to perform a fixed effect vector decomposition in multiple stages. > >> > >> Can anyone help? > >> > >> Frank Barbera > >> > >> > >> * > >> * For searches and help try: > >> * http://www.stata.com/help.cgi?search > >> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**st: assigning the value of a function to a amcro** - Next by Date:
**Re: st: assigning the value of a function to a amcro** - Previous by thread:
**st: assigning the value of a function to a amcro** - Next by thread:
**st: Update to -stgenreg- on SSC** - Index(es):