# st: Running a regression for a subset of observations issue

 From "Nuno" To Subject st: Running a regression for a subset of observations issue Date Fri, 6 Jul 2007 21:07:54 +0100

```Hello everyone,

Does anyone know if Stata is able to cyclically run n regressions on a n
observations sample, but at each ith cycle the ith observation is excluded
from the sample that will be used in the estimation?

The idea is the following: I have a sample of firms which are classified in
a particular SIC code. There is a model (Jones (1991)) that for each firm in
a given SIC estimates a regression based on the firms that compose that SIC,
excluding the firm being analyzed and then uses the estimated coefficients
to determine the expected value of a given variable for the excluded firm.
This might seem confuse, but the steps are quite straightforward (although I
can't implement it in Stata...).

So imagine we have in a given SIC code 10 companies. Then, the procedure
would do the following:
1. Run the regression Y=a0+a1*X1+a2*x2 and obtain the coefficients estimates
for all the 9 observations excluding the 1st one;
2. Use the estimated coefficients to determine the expected value of Y for
the first firm;
3. Repeat 1 and 2 for the 2nd, 3rd, 4th ... firms in that SIC, excluding the
2nd, 3rd, 4th ... firm in each step.

Controlling for each SIC code is easy (just use -foreach-) but I'm unable to
implement steps 1-3...
Any ideas?

Best

Nuno

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