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
replacing missing with non-missing within the same variableBelow is an example of the dataset (for some reason the columns are not lining up with the variables…
Errors using random slope on dummy variableHello,
Thank you for reading my post. I am seeking advice about the following problem:
I am estimat…
How to select/specify variables to include in a table with descriptive statistics?Dear Stata Users,
I run the following code to generate a table:
Code:
unab stubs : *_X
local st…
Generate a variable based on id number and its chosen indicatorDear Stata users,
I encounter this question when using one-to-one matching. The variable id is numb…
Collinearity with long-run averageHi,
I am creating a long-run average of crime rates disaggregated which are reported at the distric…
Subscribe to:
Post Comments (Atom)
0 Response to Store Regression Coefficients after Loop
Post a Comment