Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • significance stars with coefficients in matrix

    Hi all,

    I run a set of regressions, where the independent variable as well as the lag of the independent variable vary, so that I obtain 10x4 regressions. For matters of overview I put the obtained coefficients into a matrix. I also put the standard errors into a second matrix.
    However, I would much prefer to have significance asterisks next to the coefficients, for obvious oversight reasons.

    Unfortunately I have not yet figured out how to do this.

    my command so far is:
    I only include the part of the code that I think is crucial for my question. below is the extended code:
    Code:
    matrix beta_01 = J(4,10,.)
    matrix se_01 = J(4,10,.)
    
     matrix beta_01[`i'+1,k] = _b[myindep`var'_lag`i']
     matrix se_01[`i'+1,k] = _se[myindep`var'_lag`i']
    In this version of my code, I included my actual regression code, even though I don't think the regression matters. But mybe it helps:

    Code:
    local myvarlist 10 vars
    matrix beta_01 = J(4,10,.)
    matrix se_01 = J(4,10,.)
    foreach var of varlist `myvarlist' {
    scalar m =m+1
        qui regress mydepvar myindep`var'
        matrix beta_01[1,m] = _b[myindep`var']
        matrix se_01[1,m] = _se[myindep`var']
    scalar k = k+1
    forval i=1/3 {
    qui regress mydepvar myindep`var'_lag`i'
     matrix beta_01[`i'+1,k] = _b[myindep`var'_lag`i']
     matrix se_01[`i'+1,k] = _se[myindep`var'_lag`i']    
    }
    }
    Kind regards
    Christian

  • #2
    The easy way is to use outreg2 or estout which are all set up do to the stars. Programming this seems like a lot of trouble when the software is already available.

    As the User Guide says, "to Stata, a matrix is a named entity containing an r  c (0 < r  matsize, 0 < c  matsize) rectangular array of double-precision numbers (including missing values) that is bordered by a row and a column of names". So, you can't put stars in a matrix. If you are determined to program this yourself, you could write into variables.

    Comment

    Working...
    X