Dear Stata users,
I'm running several sub-sample regressions over a factor variable, and would like to create a matrix containing the estimates vectors of each regresssion.
However, when my subsample doesn't include enough observations for a category of the explicative variable, it doesn't appear on the estimates.
The vectors I recover are therefore not directly comparable since the xth line of one doesn't necessarly corresponds to the same variable in each.
Here's an example.
As you see the two matrices don't have the same dimensions, because the categories1 and 2 of rep78 are omitted in the second regression
Therefore, the final line causes an error, and the coefficient associated with category 3 is in 3rd row b0, but in the first in b1.
I'd like to add two rows of missing values in the first two rows of b1, to make the matrix comparable and of the same dimension.
Thanks a lot,
Charlie
I'm running several sub-sample regressions over a factor variable, and would like to create a matrix containing the estimates vectors of each regresssion.
However, when my subsample doesn't include enough observations for a category of the explicative variable, it doesn't appear on the estimates.
The vectors I recover are therefore not directly comparable since the xth line of one doesn't necessarly corresponds to the same variable in each.
Here's an example.
Code:
sysuse auto2.dta,clear reg price ib5.rep78 if foreign==0 matrix b0=e(b)' reg price ib5.rep78 if foreign==1 matrix b1=e(b)' matrix list b0 matrix list b1 matrix M=b0,b1
Therefore, the final line causes an error, and the coefficient associated with category 3 is in 3rd row b0, but in the first in b1.
I'd like to add two rows of missing values in the first two rows of b1, to make the matrix comparable and of the same dimension.
Thanks a lot,
Charlie
Comment