Announcement

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

  • Using Putexcel for estat esize

    Dear All

    I have used the putexcel command to successfully export regression results to an excel sheet. Additionally I'd like to export omega-squared from the
    Code:
    estat esize, omega
    command for each independant variable in my regression model.

    However, I cannot figure out how to do this. So, I run my regression and the effect size command. This is what my effect size output looks like

    Click image for larger version

Name:	Unbenannt.PNG
Views:	2
Size:	13.3 KB
ID:	1604365

    Within my putexcel command (following the command for exporting my regression results), I have tried
    Code:
       estat esize, omega
        matrix stats = r(stats)
        matrix o1 = stats[2,1..1]
        putexcel J`row'=matrix(o1), nformat(#.0000)
    With this code, for example, I trying to export the omega-squared for "CO" into column J. However, Stata always exports data from my regression table, not from the effect size output.
    I feel like I am missing something here, but I cannot get my head around. I was wondering, if it is even possible to use putexcel for commands that do not specify certain variables but instead are connected to a previous command...?

    Thank you in advance for your help!
    Best
    Kristin
    Attached Files

  • #2
    Run either

    Code:
    return list
    or

    Code:
    ereturn list
    to see if and where results are stored after running a particular command. In this case, Stata stores the results in matrix r(esize).

    Code:
    webuse lbw, clear
    regress bwt smoke i.race
    estat esize, omega
    mat l r(esize)
    mat wanted= r(esize)[1..., "omega2".."df_num"]
    mat l wanted

    Res.:

    Code:
    . estat esize, omega
    
    Effect sizes for linear models
    
    -------------------------------------------
                 Source | Omega-Squared      df
    --------------------+----------------------
                  Model |    .1088457         3
                        |
                  smoke |    .0715877         1
                   race |    .0806144         2
    -------------------------------------------
    Note: Omega-Squared values for individual model terms are partial.
    
    .
    . mat wanted= r(esize)[1..., "omega2".."df_num"]
    
    .
    . mat l wanted
    
    wanted[3,2]
                omega2     df_num
      Model  .10884568          3
      smoke  .07158773          1
    1b.race  .08061444          2
    
    .

    Comment


    • #3
      It worked! Thank you so much, Andrew!

      Comment

      Working...
      X