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

From |
"Thomas Jacobs" <thomasjacobs@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: re: help with sureg |

Date |
Mon, 13 Oct 2008 17:16:17 -0500 |

Kit, Thanks very much for the explanation. That was helpful. You were certainly correct on the coffee comment. I had already cribbed the `eqn' logic from your Modern Econometrics text and run with manually generated lags. Using the tsset will be much cleaner. Thanks again. Tom On Mon, Oct 13, 2008 at 4:15 PM, Kit Baum <baum@bc.edu> wrote: > < > > Thomas said: > > I am trying to use sureg on a dataset of approximately 50 firms with > 900 trading days of observations: > > . xtset > panel variable: CompanyNum (strongly balanced) > time variable: TradeDateNum, 501 to 1402 > delta: 1 unit > > I keep only the necessary variables: > > . keep TradeDateNum CompanyNum LnRt* > > and reshape from long to wide for the company specific variables: > > . reshape wide LnRtFiveYrMid LnRtStock, i(TradeDateNum) j(CompanyNum) > (note: j = 1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 22 23 24 > 25 26 27 28 29 30 32 33 >> 34 35 36 37 38 39 40 41 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57) > > Data long -> wide > ----------------------------------------------------------------------------- > Number of obs. 47806 -> 902 > Number of variables 10 -> 113 > j variable (53 values) CompanyNum -> (dropped) > xij variables: > LnRtFiveYrMid -> LnRtFiveYrMid1 > LnRtFiveYrMid2 ... LnRtFiveYrM >> id57 > LnRtStock -> LnRtStock1 LnRtStock2 > ... LnRtStock57 > ----------------------------------------------------------------------------- > > I then attempt to execute sureg on my current pooled OLS specification > for just two firms: > > . sureg (LnRtFiveYrMid1 L(1/2).LnRtFiveYrMid1 L(0/4).LnRtCDX LnRtCMT > LnRtTED L(0/2).LnRtStoc >> k1) (LnRtFiveYrMid2 L(1/2).LnRtFiveYrMid2 L(0/4).LnRtCDX LnRtCMT LnRtTED >> L(0/2).LnRtStock2 >> ) > variable CompanyNum not found > > and I get the error CompanyNum (the dropped variable after reshaping > to wide) not found. So far, the only way it will run is if I exclude > time series operators: > > . sureg (LnRtFiveYrMid1 LnRtCDX LnRtCMT LnRtTED LnRtStock1) > (LnRtFiveYrMid2 LnRtCDX LnRtCMT >> LnRtTED LnRtStock2) > > Seemingly unrelated regression > ---------------------------------------------------------------------- > Equation Obs Parms RMSE "R-sq" chi2 P > ---------------------------------------------------------------------- > LnRtFiveY~d1 887 4 .0453147 0.1464 152.27 0.0000 > LnRtFiveY~d2 887 4 .0479444 0.0777 74.68 0.0000 > ---------------------------------------------------------------------- > > ------------------------------------------------------------------------------ > | Coef. Std. Err. z P>|z| [95% Conf. > Interval] > -------------+---------------------------------------------------------------- > LnRtFiveY~d1 | > LnRtCDX | .5369359 .054891 9.78 0.000 .4293515 > .6445204 > LnRtCMT | -.3181771 .0979303 -3.25 0.001 -.5101169 > -.1262374 > LnRtTED | -.0106727 .0188642 -0.57 0.572 -.0476459 > .0263005 > LnRtStock1 | .0629164 .1021791 0.62 0.538 -.1373509 > .2631838 > _cons | -.0006975 .0015239 -0.46 0.647 -.0036843 > .0022893 > -------------+---------------------------------------------------------------- > LnRtFiveY~d2 | > LnRtCDX | .362548 .0568002 6.38 0.000 .2512216 > .4738745 > LnRtCMT | -.3034092 .1032472 -2.94 0.003 -.5057699 > -.1010485 > LnRtTED | -.0484131 .019944 -2.43 0.015 -.0875027 > -.0093235 > LnRtStock2 | -.0617068 .0777801 -0.79 0.428 -.214153 > .0907394 > _cons | -.0000496 .0016117 -0.03 0.975 -.0032085 > .0031093 > ------------------------------------------------------------------------------ > > Does sureg prevent the use of time series operators? If so, am I best > to manually generate all the lags before reshaping or after? Any > other suggestions? Thanks. > > > > The problem is that -tsset- (or -xtset-) remembers how your original > long-format data were defined, in terms of CompanyNum and TradeDateNum. > -sureg- is happy to accept timeseries operators, as -help sureg- indicates. > But you must after using -reshape- reestablish the -tsset-, which will now > be just > > tsset TradeDateNum > > as what you have now is a pure timeseries dataset. Then you should be able > to give the -sureg- command. > > As you have 57 equations to specify, I suggest you use a -local- and a > -forvalues- loop over company numbers to build up the equation list. > For instance, as a simplified example, > > local eqlist > forv i = 1/57 { > local eqlist "`eqlist' (LnRtFiveYrMid`i' LnRtCDX LnRtCMT LnRtTED > LnRtStock`i')" > } > > Just make sure you never use an equals sign in this local statement. You can > then say > > sureg `eqlist' > > and go have a cup of coffee. > > > Kit Baum, Boston College Economics and DIW Berlin > http://ideas.repec.org/e/pba1.html > An Introduction to Modern Econometrics Using Stata: > http://www.stata-press.com/books/imeus.html > > > * > * 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/ > -- Thomas Jacobs * * 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: re: help with sureg***From:*Kit Baum <baum@bc.edu>

- Prev by Date:
**st: heckman with panel** - Next by Date:
**st: Testing linear equations in a multilevel model** - Previous by thread:
**st: re: help with sureg** - Next by thread:
**Re: Re: st: re: help with sureg** - Index(es):

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