Dear all,
I have the following data format where type is the type of the car (categorical). At each year, I have different number of car types.
input float ln_price long type long year
2.3 4 1998
1.3 3 1998
0.3 2 1998
1.2 4 1999
0.8 5 1999
3.6 2 1999
4.9 3 1999
2.3 1 2000
6.5 5 2000
4.2 2 2000
7.2 3 2000
end
What I want to do is that I want to run a regression, say, for each year, and store the coefficients of the categorical variable type. Because the number of coefficients changes year by year, I cannot combine two different matrices as suggested here:
https://stackoverflow.com/questions/...-file-when-the
or using statsby.
With the following command, I can store each regression coefficients as matrix:
forval i=1998/2000 {
reg ln_price i.type if year ==`i'
matrix betas_`i'=nullmat(beta) \ e(b)
}
However, I could not find a way to combine these new matrices since they have different number of independent variables.
Is it possible to store and combine regression coefficients that have different number of output variables?
Thanks for your time in advance.
Regards,
Related Posts with Store Regression Coefficients after Loop
Child immunization for NigeriaHello everyone. I am working with Stata where I'm trying to combine the different variables on chil…
Trying to make a plot with median and CIHi, I would like to create a plot that shows the median of a variable within two different groups w…
Regression with Indicator Function splitting Independent Variable into 2 SubgroupsHi All, I'm working on trying to get the results from the following regression which is a formula u…
Generating decile portfolio'sDear Statalist, I would like to ask for help regarding a question I've been pondering. I am replica…
Replicating graphHow can I replicate this graph if I have similar data to what is presented in it? Array …
Subscribe to:
Post Comments (Atom)
0 Response to Store Regression Coefficients after Loop
Post a Comment