Statalist The Stata Listserver


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

Re: st: running regressions for sub-samples


From   Philipp Rehm <[email protected]>
To   [email protected]
Subject   Re: st: running regressions for sub-samples
Date   Tue, 08 Aug 2006 15:16:23 +0200

You could generate an identifier variable and condition your regressions on it (or use -statsby- or the like).
You could generate a variable containing the median for each year of variable x3it:

bys year: egen median=median(x3it)

Then, you could condition your estimations:

reg yit x1it x2it x3it yr* if x3it < median
reg yit x1it x2it x3it yr* if x3it >= median & median != .

Using a similar logic, you could generate an identifier variable (say, id), and then run the regressions as: "bys id: reg ..." or using -statsby- (or something similar).

HTH,
Philipp

tabreez shams wrote:

Hi,
I am using the following two models on an unbalanced
panel data over period 1997 to 2004:

1. reg yit x1it x2it x3it yr*
2. xtreg yit x1it x2it x3it yr*, fe small

Now I want to re-run the regression for sub-samples
based on the following criteria:

if x3it is less than the median value of x3it in each
year. Obviously, the other one is if x3it is equal or
more than the median value of x3it in each year.

Much appreciate if anyone can kindly provide the
statement/macro to run the models for the sub-samples
in Stata/SE 8.2.

Regards,
Shams
PhD Candidate
Accounting and Finance Dept.
Monash University,
Australia

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com *
* 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/


*
*   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/



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