1

I have a panel of bond spreads. Spreads are from a specific issuer (firm) and maturity (eg 2, 4, etc years). The problem is that Stata's tsset (or xtreg) command takes two variables to set the data structure. In my case no two variables uniquely identifies each observation.

If I do: tsset issuer_id Date

I get the error: repeated time values within panel

My data looks like the following:

Issuer   Date   Spread Maturity IndependtVar1 IndependentVar2 ...
Issuer1  apr12  2.2    2           ...
Issuer1  apr12  3.3    4
...
Issuer2  apr12  2.5    2
Issuer2  apr12  2.8    4
...

Is there any way around this? (except for converting to a wide-format data, eg a separate spread variable for each maturity)

Thank you

luffe
  • 265
  • tsset is preparation for time series analysis. Are you proposing to conduct time series with more than one variable serving the role of time? Or what? Please be specific about what you are attempting to accomplish. – whuber Oct 07 '12 at 19:19
  • @whuber I am planning to run the regression: spread = Maturity + IndependentVar1 + IndependentVar2 + .. + Issuer2(Dummy) + Issuer3(Dummy) +... Thanks – luffe Oct 07 '12 at 20:45
  • Since there's no time in that regression, why are you considering tsset? – whuber Oct 07 '12 at 20:56
  • @whuber Oh sorry, I forgot to mention that I would like to have the option to run time series commands like ac and dfuller (autocorrelation plot, unit root test). And I also wish to use Newey-West standard errors, and the "newey" command requires a tsset. Thank you – luffe Oct 07 '12 at 21:05
  • OK-but what sense would these commands make when you aren't actually including time as a variable in your regression? – whuber Oct 08 '12 at 15:31
  • What do you mean? Why do I need to include time as a variable for that to make sense? The above regression specification needs standard errors to be adjusted for serial correlation, and the Date variable keeps track of each observation trough time... – luffe Oct 08 '12 at 17:20
  • Thank you: finally your question becomes clearer! Until that last comment, we had no explicit information about how you intended to incorporate time in your analysis. But how exactly would you define "serial correlation" with data, like these, that consist of multiple observations at each time? I suspect your reply to that might indicate how the data should be broken down for analysis. – whuber Oct 08 '12 at 18:22
  • I decided to do the tsset as below, when using the newey regression command, this allows each observation for any issuer/maturity pair to be correlated over time – luffe Oct 09 '12 at 18:12

1 Answers1

1

Solution: egen id=group(Issuer Maturity) tsset id Date

luffe
  • 265