Hello,
I don't know if this can be considered as a mata programming question, but I am trying to insert t-statistics and the coefficients in the same matrix (10x5).
So far, I have been able to create two distinct matrices (5x5): K_m for the coefficients and K_t for the t-stats. I would like to have a K matrix instead with t-stats below my coefficients (and if possible within parenthesis).
The data structure has 5 id variables (univ_cut) and 5 numerical variables as varliest. For the syntax, tid is a time variable.
This is my code:
I have been struggling with the iterators (j and i) inside the matrices to append the t-stats in a matrix K (`i'+1,`j').
Or similar, maybe I need to include another double loop? But I can't figure out how.
I don't know if this can be considered as a mata programming question, but I am trying to insert t-statistics and the coefficients in the same matrix (10x5).
So far, I have been able to create two distinct matrices (5x5): K_m for the coefficients and K_t for the t-stats. I would like to have a K matrix instead with t-stats below my coefficients (and if possible within parenthesis).
The data structure has 5 id variables (univ_cut) and 5 numerical variables as varliest. For the syntax, tid is a time variable.
This is my code:
Code:
mat K_m = J(5,5,.) mat K_t = J(5,5,.) local j = 1 foreach v in f1r_rf100 f1m1W_36_b_cons100 f1m2W_36_b_cons100 f1m3W_36_b_cons100 f1m4W_36_b_cons100 { forvalues i = 1(1)5 { qui: newey2 `v' if univ_cut==`i', lag(2) t(tid) force matrix mattest= r(table) matrix K[`i',`j']=mattest[1,1] matrix K[`i',`j']=mattest[3,1] } local ++j }
Code:
mat K = J(10,5,.) local j= 1 foreach v in f1r_rf100 f1m1W_36_b_cons100 f1m2W_36_b_cons100 f1m3W_36_b_cons100 f1m4W_36_b_cons100 { forvalues i = 1(1)5 { qui: newey2 `v' if univ_cut==`i', lag(2) t(tid) force matrix mattest= r(table) matrix K[`i',`j']=mattest[1,1] matrix K[`i'+1,`j']=mattest[3,1] } local ++j }
Comment