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
How to find duplicate across variablesHello, I am relatively new to stata, but I have encountered a problem of not being able to find dup…
rate of admission in NRDhello all i'm working on NRD I am looking to compare rate of hospitalizations before and after certa…
endogeneity test after xtologit and xtoprobitHi all, please I need help with testing for endogeneity after xtologit and xtoprobit. Firstly, how d…
data annualizationDear all, May I have your guidance please on the following: I have 5 subjects with 5 observations ov…
Simple graphing issueI am tring to create a simple bar graph, but I cannot get the categories on the x axis to display as…
Subscribe to:
Post Comments (Atom)
0 Response to Store Regression Coefficients after Loop
Post a Comment