Wednesday, March 22, 2006

st: "sureg" with long-format data

Hello all,

I have searched the web and available Stata faqs and helpfiles for an answer to an sureg question and am unable to find one on my own. Much obliged if anyone can help me through this particular puzzle.

I have a dataset oriented lengthwise where observations are grouped by country and year. I would like to run sureg using this vertical orientation. For example, in the sureg syntax, I would like to write "sureg (yvar xvar)" as equation 1 representing the first 35 observations, followed by "(yvar xvar)" as equation 2 representing the next 35 observations, and so on. My difficulty is that without re-orienting the data width-wise (which creates a cumbersome heap of newly-named X and Y variables and stops me from being able to tweak the regressions around the edges) I have no way to distinguish for Stata that instead of each equation having different Y and X variable names, each equation has the same variable names but should contain a different set of 35 observations. My abbreviated dataset looks like:

Country Year Yvar Xvar Australia 2004 .5 14 Australia 2003 .6 17 .... .. Australia 1970 .2 10

Austria 2004 .9 35 Austria 2003 .8 14 .... .. Austria 1970 .15 14

Belgium 2004 .13 7 .... (and so on for approximately 100 countries)

Ideally, the sureg command would allow something like "by country: sureg (Yvar Xvar)" but instead, I have to reorient the data widthwise and write "sureg (YvarAustralia XvarAustralia) (YvarAustria XvarAustria)..." for about one-hundred different equations (and change all 100 when I make adjustments). Requiring this horizontal orientation to make sureg work seems remarkably inefficient in the command line, but I can't seem to find another way around it. Many thanks for any and all ideas.

Cheers, Eric

Eric K. Bielke Regulatory Economics Advisor Level 2, Telecom House, 68-86 Jervois Quay, P O Box 570, Wellington, New Zealand

This communication, including any attachments, is confidential. If you are not the intended recipient, you should not read it - please contact me immediately, destroy it, and do not copy or use any part of this communication or disclose anything about it. Thank you. Please note that this communication does not designate an information system for the purposes of the Electronic Transactions Act 2002.

* * For searches and help try: * * *


Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?