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
Error when run heatplot with "function drop() not declared in class ColrSpace (120 lines skipped) " Code: ssc install heatplot Code: ssc install palettes, replace Code: ssc install colrspace, repla…
Asymptomatic/Finite Sample analysisThis may not be the forum for this- perhaps Cross- Validated, but I don't have a Stata question as m…
reshape errorDear Stata users, I am facing problem with -reshape wide- command. More specifically, I would like …
Removing Leading and Trailing SpacesConsider the following full worked example Code: import delimited "http://qed.econ.queensu.ca/jae/d…
Fixed effect model for hospital and patietn level data (really need some help)Hi, I am exploring a dataset of patient data from 20 hospitals for 3 years. Among which 9 hospitals…
Subscribe to:
Post Comments (Atom)
0 Response to Store Regression Coefficients after Loop
Post a Comment