Panel Data, Individual Specific Regression

#1
Hi All,

I have an implementation question for stata. I have a panel data set with several thousand individuals and several dozen months of data for each.

I actually want to do something which makes my panel data completely irrelevant, which is to run several thousand (one for each individual) separate regressions of the form

y_it = c_i + B_i*X_t

Where B_i is an individual-specific vector of coefficients for some vector of X_t time-varying independent variables.

I realize that I can just do this with something like:

by i: reg y X

My question is...is there a way to generate a matrix of the coefficients B that I can store, or save, or hide away somewhere for further analysis?

I really apologize if this is a stupid question or has been posted before. I've been searching for hours on all different sites for the answer--perhaps I really just don't know how to describe what I'm asking for.

Many thanks in advance for the help!

Leo
 
#3
Hi there,

You can store the results from all your regression with est sto or generate a matrix in which each column corresponds to your B_i. For instance if you want to store all the results :

levelsof id, local(id)
foreach i of local id {
reg y X if id == `i'
est sto b`i'
}

To store the betas in a matrix create matrix like this : matrix A = e(b). You can combine this with the previous loop by doing smth like = matrix A = (A, e(b))

Hope this helps!

Etienne