[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Clive Nicholas" <Clive.Nicholas@newcastle.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: fixed, random effects |

Date |
Mon, 28 Nov 2005 01:37:02 -0000 (GMT) |

Raphael Schoenle wrote: > I have tried to solve a simple problem for days but I can't figure out > how to run it properly in Stata. If someone could give me a hint, this > would be really great. > > Basically, I want to run a standard fixed, and random effects > regression (xtreg in STATA) but with _variable_ weights (they > correspond to changing industry shares in the market). > > So, for the random effects I tried gllamm but always get an error > message of insufficient observations when I try to use weights. > > Here is what I do: > > sort ind7090 > gllamm dsc dperc dcomp, i(ind7090) pw(wt) > > any ideas what goes wrong? > > (if there are no weights, then we just get the xtreg dsc dperc dcomp, > fe results.) One elementary solution that gets round this problem in -gllamm- (or -xtreg-, if you prefer) would be to interact your weight with each of the explanatory variables in your model. However, the specification I would offer you might prove controversial to some in terms of model specification and thus model interpretation (see below). First, using a toy dataset, let's generate some weights and interactions (when you run this, notice how carefully I've simulated the weighting variable here): . clear . webuse grunfeld . g weight=invnorm(uniform()) . replace weight=(weight+_N)/_N (200 real changes made) . g mvalueXweight=mvalue*weight . g kstockXweight=kstock*weight . g timeXweight=time*weight . tsset company year . gllamm invest mvalue kstock time, i(company) Iteration 0: log likelihood = -1191.6318 (not concave) [...] Iteration 7: log likelihood = -1098.0719 number of level 1 units = 200 number of level 2 units = 10 Condition Number = 3885.5639 gllamm model log likelihood = -1098.0719 Robust standard errors -------------------------------------------------------------------------- invest | Coef. Std. Err. z P>|z| [95% Conf. Interval] ----------+---------------------------------------------------------------- mvalue | .1096954 .005726 19.16 0.000 .0984726 .1209182 kstock | .3745101 .0342796 10.93 0.000 .3073233 .441697 time | -3.206458 1.828845 -1.75 0.080 -6.790929 .3780136 _cons | -42.40668 18.85687 -2.25 0.025 -79.36547 -5.447888 --------------------------------------------------------------------------- Variance at level 1 --------------------------------------------------------------------------- 3044.6811 (1075.4094) Variances and covariances of random effects --------------------------------------------------------------------------- ***level 2 (company) var(1): 9104.3989 (1377.012) --------------------------------------------------------------------------- Note the coefficients you see here compared what is to come. Now, we run the 'interactive' model with weights: . gllamm invest mvalueXweight kstockXweight timeXweight, i(company) Iteration 0: log likelihood = -1191.2958 (not concave) [...] Iteration 7: log likelihood = -1097.8643 number of level 1 units = 200 number of level 2 units = 10 Condition Number = 3887.1525 gllamm model log likelihood = -1097.8643 --------------------------------------------------------------------------- invest | Coef. Std. Err. z P>|z| [95% Conf. Interval] ----------+---------------------------------------------------------------- mvalueXwe | .1096633 .0035387 30.99 0.000 .1027276 .116599 kstockXwe | .374551 .019511 19.20 0.000 .3363102 .4127917 timeXwe | -3.184235 .8377363 -3.80 0.000 -4.826168 -1.542302 _cons | -42.58643 8.758511 -4.86 0.000 -59.7528 -25.42007 --------------------------------------------------------------------------- Variance at level 1 --------------------------------------------------------------------------- 3038.3736 (303.91209) Variances and covariances of random effects --------------------------------------------------------------------------- ***level 2 (company) var(1): 9065.5516 (936.56468) --------------------------------------------------------------------------- The parameter estimates, their standard errors, the overall model fit and the model diagnostics barely change. That's how it should be: the weight is only deployed to make slight upward or downward adjustments on the estimates. The parameter estimates don't change at all if I add -year- as the level 1 variable (i.e, -i(year company)-, although it comes out as a level 2 variable! Still estimating the variable at this level turns out to produce some interesting information). Note here that I do not follow the model specification as advised by Braumoeller (2004) when running models with interactions. He argues that you _must_ include the first order terms and the interaction variable (here, the weight) along with the interaction terms. However, running this 'full' model here forces us to interpret the interaction coefficients only, but you will find that if you do this, all of the coefficient signs are (implausibly) reversed. Interpretation on the first-order terms (i.e., the original variables) is inadmissible in this model because the coefficients only take these values when the weight = 0: but none of the weights are 0 in our example. You'll also get some ridiculously large coefficients in the 'full' model as well. Thus, I would argue that, in this instance, it would be more sensible to run the pared-down 'interactive' model I've shown here. I hope this helps. :) CLIVE NICHOLAS |t: 0(044)7903 397793 Politics |e: clive.nicholas@ncl.ac.uk Newcastle University |http://www.ncl.ac.uk/geps Reference: Braumoeller BF (2004) "Hypothesis Testing and Multiplicative Interaction Terms", INTERNATIONAL ORGANIZATION 58(4): 807-20. * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: fixed, random effects***From:*Raphael Schoenle <schoenle@Princeton.EDU>

- Prev by Date:
**RE: RE: st: string functions on the name of a variable** - Next by Date:
**st: help with understanding syntax 'gen last=_n==_N'** - Previous by thread:
**RE: st: help to understand syntax 'qui by study: gen last=_n==_N'** - Next by thread:
**st: RE: fixed, random effects** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |