Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
rs.net@me.com |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Different coefficients for xtivreg2 |

Date |
Wed, 04 Apr 2012 20:31:24 +0100 |

Mark, That worked! Thanks for your help. In hindsight, the error does look very silly. Now, on to cracking that weak instrument problem :) Thanks! Rohit On 4 Apr 2012, at 20:17, Schaffer, Mark E wrote: > Rohit wrote to me off-list because his email to the list bounced - he was trying to include too much information. I am replying to the list with this post (and with some trims so that it won't bounce). > > Rohit, > > The output of the two estimations you sent report different numbers of groups and use different numbers of observations, the latter because because they identify and then exclude different numbers of singleton observations. > > Estimation 1: > > Number of groups=595 > N=2527 > Singletons=181 > > Estimation 2: > > Number of groups=457 > N=2690 > Singletons=18 > > Unless you provide -xtivreg2- with the panel identifier using the -ivar()- option, it will deduce this from how the data are -xtset-. My guess is that the panel identifier is changing between the two estimations. You can check this using the -xtset- command just prior to the estimation, e.g., > > . webuse grunfeld > > . xtset > panel variable: company (strongly balanced) > time variable: year, 1935 to 1954 > delta: 1 year > > Another check is to estimate using Stata's official -xtivreg- (but minus, of course, all the options specific to -xtivreg2-) and see if the results also change between the two settings. > > HTH, > Mark > > ************************************************* > > Hi Mark, > > Apologies for sending tis email to you directly but my query was bouncing off the email list due to the result being too long. I hope this is ok. > > I am using Stata 12 and have the updated versions of -xtivreg2-, -ivreg2- and -ranktest-. > > My issue is that the -xtivreg2- command is producing two different estimates when I process my do file in 2 different ways. Let me explain the process below: > > 1. I run the do file including some -xtreg- regressions prior to xtivreg2. The output produced by -xtivreg2- is as follows: > > . xtivreg2 sd lsale mtb lev salesg ppe lcash l0ret (wceo_vega_t_hlq wceo_delta_t_hlq = lcashceo ceoage ceo_tenure) >> if add_tot2==1, fe ffirst cluster(gvkey sic2) endog(wceo_vega_t_hlq wceo_delta_t_hlq) > Warning - singleton groups detected. 181 observation(s) not used. > > FIXED EFFECTS ESTIMATION > ------------------------ > Number of groups = 595 Obs per group: min = 2 > avg = 4.2 > max = 8 > > <snip> > > Number of clusters (1) N_clust1 = 450 > Number of clusters (2) N_clust2 = 53 > Number of observations N = 2527 > Number of regressors K = 9 > Number of endogenous regressors K1 = 2 > Number of instruments L = 10 > Number of excluded instruments L1 = 3 > > IV (2SLS) estimation > -------------------- > > Estimates efficient for homoskedasticity only > Statistics robust to heteroskedasticity and clustering on gvkey and sic2 > > Number of clusters (gvkey) = 450 Number of obs = 2527 > Number of clusters (sic2) = 53 F( 9, 52) = 1.06 > Prob > F = 0.4070 > Total (centered) SS = 68.69844217 Centered R2 = -31.8567 > Total (uncentered) SS = 68.69844217 Uncentered R2 = -31.8567 > Residual SS = 2257.204888 Root MSE = 1.081 > > ---------------------------------------------------------------------------------- > | Robust > sd | Coef. Std. Err. z P>|z| [95% Conf. Interval] > -----------------+---------------------------------------------------------------- > wceo_vega_t_hlq | .0106644 .0286816 0.37 0.710 -.0455505 .0668793 > wceo_delta_t_hlq | -.0000691 .0002423 -0.29 0.775 -.000544 .0004058 > lsale | -.0737755 .2568503 -0.29 0.774 -.5771929 .4296419 > mtb | -.0640726 .0696261 -0.92 0.357 -.2005372 .072392 > lev | .1073176 .3918854 0.27 0.784 -.6607637 .8753989 > salesg | -.2151609 .2696577 -0.80 0.425 -.7436803 .3133585 > ppe | .5911214 1.058432 0.56 0.577 -1.483367 2.66561 > lcash | -.0461674 .1565831 -0.29 0.768 -.3530647 .2607299 > l0ret | .0440422 .1035994 0.43 0.671 -.1590088 .2470933 > ---------------------------------------------------------------------------------- > > <snip> > > 2. Now, I run the same do files, but only process some computations without running the -xtreg- commands. After computations, I run -xtivreg2- as the first regression. The output is as follows: > > . xtivreg2 sd lsale mtb lev salesg ppe lcash l0ret (wceo_vega_t_hlq wceo_delta_t_hlq = lcashceo ceoage ceo_tenure) >> if add_tot2==1, fe ffirst cluster(gvkey sic2) endog(wceo_vega_t_hlq wceo_delta_t_hlq) > Warning - singleton groups detected. 18 observation(s) not used. > > FIXED EFFECTS ESTIMATION > ------------------------ > Number of groups = 457 Obs per group: min = 2 > avg = 5.9 > max = 8 > > <snip> > > Number of clusters (1) N_clust1 = 457 > Number of clusters (2) N_clust2 = 53 > Number of observations N = 2690 > Number of regressors K = 9 > Number of endogenous regressors K1 = 2 > Number of instruments L = 10 > Number of excluded instruments L1 = 3 > > IV (2SLS) estimation > -------------------- > > Estimates efficient for homoskedasticity only > Statistics robust to heteroskedasticity and clustering on gvkey and sic2 > > Number of clusters (gvkey) = 457 Number of obs = 2690 > Number of clusters (sic2) = 53 F( 9, 52) = 4.19 > Prob > F = 0.0004 > Total (centered) SS = 82.17298598 Centered R2 = -6.4810 > Total (uncentered) SS = 82.17298598 Uncentered R2 = -6.4810 > Residual SS = 614.7354494 Root MSE = .5247 > > ---------------------------------------------------------------------------------- > | Robust > sd | Coef. Std. Err. z P>|z| [95% Conf. Interval] > -----------------+---------------------------------------------------------------- > wceo_vega_t_hlq | -.0045747 .0051782 -0.88 0.377 -.0147237 .0055743 > wceo_delta_t_hlq | .0000662 .0001226 0.54 0.589 -.000174 .0003064 > lsale | .0225228 .0356792 0.63 0.528 -.0474072 .0924529 > mtb | -.0327104 .0237809 -1.38 0.169 -.0793202 .0138993 > lev | .2204397 .1162169 1.90 0.058 -.0073412 .4482206 > salesg | -.1236074 .0722195 -1.71 0.087 -.265155 .0179403 > ppe | .0550015 .5051602 0.11 0.913 -.9350943 1.045097 > lcash | .0148685 .015655 0.95 0.342 -.0158146 .0455517 > l0ret | -.0097763 .0143979 -0.68 0.497 -.0379957 .018443 > ---------------------------------------------------------------------------------- > > <snip> > >> -----Original Message----- >> From: owner-statalist@hsphsun2.harvard.edu >> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of >> Richard Herron >> Sent: 04 April 2012 14:30 >> To: statalist@hsphsun2.harvard.edu >> Subject: Re: st: Different coefficients for xtivreg2 >> >> -set seed- sets the seed for the random number generator, >> which would generate replicable results for options that use >> random numbers, but you're not using any, so the problem is elsewhere. >> >> But the package author is on this thread now, so he can help >> you find the actual source of your problem. :) >> >> Richard Herron >> >> >> >> On Wed, Apr 4, 2012 at 05:24, <rs.net@me.com> wrote: >>> Hi Richard, >>> >>> Thanks for your response. >>> >>> Here is the function that I am calling: >>> >>> xtivreg2 y1 x1 x2 x3 x4 (x5 x6 = z1 z2), fe first >> cluster(id industry) >>> endog(x5 x6) >>> >>> May I ask what does 'set seed' do before xtivreg2? >>> >>> Rohit >>> >>> >>> On 4 Apr 2012, at 02:55, Richard Herron wrote: >>> >>> Rohit, could you provide your function call, please? >>> >>> Are you using GMM? Are you setting the random number seed? Add >>> something like -set seed 2001- before you call -xtivreg2-. >> You should >>> also set the random number seed if you bootstrap, but I don't think >>> that should affect your point estimates. >>> >>> (And -xtivreg2- is from SSC, and depends on -ivreg2-, also >> from SSC.) >>> >>> Richard Herron >>> >>> >>> On Tue, Apr 3, 2012 at 18:40, <rs.net@me.com> wrote: >>> >>> >>> Hi All, >>> >>> >>> I am having a bit of a problem with the xtivreg2 command. >> Every time I >>> >>> clear the dataset in Stata's memory and rerun the xtreg2 command, I >>> get >>> >>> different coefficients and test stats. Is that something to be >>> expected or >>> >>> is it being caused by the nature of my dataset? >>> >>> >>> Sorry if this question sounds too foolish but I am not too familiar >>> with >>> >>> the command. >>> >>> >>> Thanks! >>> >>> Rohit >>> >>> >>> >>> >>> * >>> * 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 the Sunday Times > Scottish University of the Year 2011-2012 > > We invite research leaders and ambitious early career > researchers to join us in leading and driving research > in key inter-disciplinary themes. Please see > > http://www.hw.ac.uk/researchleaders > > for further information and how to apply. > > 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/ * * 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/

**References**:**st: Different coefficients for xtivreg2***From:*rs.net@me.com

**Re: st: Different coefficients for xtivreg2***From:*Richard Herron <richard.c.herron@gmail.com>

**Re: st: Different coefficients for xtivreg2***From:*rs.net@me.com

**Re: st: Different coefficients for xtivreg2***From:*Richard Herron <richard.c.herron@gmail.com>

**RE: st: Different coefficients for xtivreg2***From:*"Schaffer, Mark E" <M.E.Schaffer@hw.ac.uk>

- Prev by Date:
**st: Syntax highlighting** - Next by Date:
**Re: st: Syntax highlighting** - Previous by thread:
**RE: st: Different coefficients for xtivreg2** - Next by thread:
**st: Escaping left quote as argument of parse in split command** - Index(es):