On Wed, 28 Jan 2009, Rebecca Zhang wrote:
Hi,
I need to run regression using OLS model for about 30 dependent
variables on the same set of independent variables. How to set up a loop
run to do it at once? All dependent variables are ordered together and
their ID are in sequence.
How about this?
<script>
list Y = y1 y2 y3
loop foreach i Y
ols Y.$i const x1 x2
end loop
</script>
However, if you're interested in keeping the coefficients for further
analysis, you'd be much better off using matrix functions, as in
<script>
list Y = y1 y2 y3
list X = const x1 x2
coeffs = mols( {Y}, {X}, null )
</script>
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
r.lucchetti(a)univpm.it
http://www.econ.univpm.it/lucchetti