Hi
Im using Stata MP 15.0 Windows 10 (64 bits) with -lincomestadd- and -reghdfe-
I generated macros and scalars from linear combinations tested using -lincomestadd-, and attached them to different regressions using -reghdfe-. I can clearly see that scalars and macros from these linear combinations have been added to the stored high density fixed effects regressions. So far, so good. However, I'm having problems when adding some of the macros generated by -lincomestadd- into a matrix. Suppose a have a matrix 2x2, where each column corresponds to models 1 and 2, while row 1 and row 2 corresponds to their tested combination and s.e. respectively. For doing that I'm generating one matrix, then calling the estimates stored by using -estimates restore- and then adding the scalars into the matrix.
However, because I want to preserve the format from the macros (stars for coefficients and parenthesis for s.e.) I would prefer to use them instead scalars. Something visually like this:
What I tried to do was to save the macros as "strings" or local values, but something is not working, it says value is not found:
(added -display- just to double check the figures and format were correct)
Any help will be appreciated
Roberto
Im using Stata MP 15.0 Windows 10 (64 bits) with -lincomestadd- and -reghdfe-
Code:
.which lincomestadd M:\Ado\plus\l\lincomestadd.ado .which reghdfe M:\Ado\plus\r\reghdfe.ado *! version 5.7.2 29jul2019
I generated macros and scalars from linear combinations tested using -lincomestadd-, and attached them to different regressions using -reghdfe-. I can clearly see that scalars and macros from these linear combinations have been added to the stored high density fixed effects regressions. So far, so good. However, I'm having problems when adding some of the macros generated by -lincomestadd- into a matrix. Suppose a have a matrix 2x2, where each column corresponds to models 1 and 2, while row 1 and row 2 corresponds to their tested combination and s.e. respectively. For doing that I'm generating one matrix, then calling the estimates stored by using -estimates restore- and then adding the scalars into the matrix.
Code:
. webuse union, clear (NLS Women 14-24 in 1968) . eststo m1: quietly reghdfe age c.union##c.black if south == 0, absorb(year) vce(robust) . lincomestadd _b[union] + _b[black] + _b[c.union#c.black] , statname(ex) ( 1) union + black + c.union#c.black = 0 ------------------------------------------------------------------------------ age | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.0682821 .0909671 -0.75 0.453 -.2465884 .1100242 ------------------------------------------------------------------------------ added macro: e(exb) : "-0.068" added macro: e(exse) : "(0.091)" added macro: e(ext) : "-0.751" added scalar: e(exb_num) = -.0682821 added scalar: e(exse_num) = .09096709 added scalar: e(ext_num) = -.75062429 . eststo m2: quietly reghdfe age c.union##c.black if south == 1, absorb(year) vce(robust) . lincomestadd _b[union] + _b[black] + _b[c.union#c.black] , statname(ex) ( 1) union + black + c.union#c.black = 0 ------------------------------------------------------------------------------ age | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.1811774 .0992281 -1.83 0.068 -.3756827 .0133278 ------------------------------------------------------------------------------ added macro: e(exb) : "-0.181*" added macro: e(exse) : "(0.099)" added macro: e(ext) : "-1.826" added scalar: e(exb_num) = -.18117743 added scalar: e(exse_num) = .09922808 added scalar: e(ext_num) = -1.8258685 . matrix mat = J(2,2,.) . forvalues i = 1/2 { 2. estimates restore m`i' 3. matrix mat[1,`i'] = e(exb_num) 4. matrix mat[2,`i'] = e(exse_num) 5. } (results m1 are active now) (results m2 are active now) . matlist mat | c1 c2 -------------+---------------------- r1 | -.0682821 -.1811774 r2 | .0909671 .0992281
Code:
| c1 c2 -------------+---------------------- r1 | -0.068 0.181* r2 | (0.091) (0.099)
(added -display- just to double check the figures and format were correct)
Code:
. matrix mat = J(2,2,.) . forvalues i = 1/2 { 2. estimates restore m`i' 3. local ex_coef : display e(exb) 4. display "`ex_coef'" 5. local ex_se : display e(exse) 6. display "`ex_se'" 7. matrix mat[1,`i'] = `ex_coef' 8. matrix mat[2,`i'] = `ex_se' 9. } (results m1 are active now) -0.068 (0.091) (results m2 are active now) -0.181* (0.099) 0.181* not found r(111);
Any help will be appreciated
Roberto
Comment