Announcement

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

  • Summary table (specifically standard deviation) for ANOVA command

    I am trying to get a summary table for my anova command (like the subcommand tabulate does when you use the oneway command).

    I've tried anova help and there's nothing there that I can see. I've also tried the summarize subcommand and it gives me a not allowed error like tabulate does.

    margins gives me all my means but it gives me standard error, I need the standard deviation though and for each y there's 16 Means and sd I need to report per 'y'- 2 locations (Pre_LTCH) over 4 time points (data_point) and 2 sex categories (Sex_AA2) so doing it by hand isn't really efficient.

    My code is (part of a macro):

    Code:
     anova `y' Sex_AA2 Pre_LTCH Sex_AA2#Pre_LTCH / ///
        unique_ID|Pre_LTCH#Sex_AA2 ///
        data_point ///
        data_point#Sex_AA2 data_point#Pre_LTCH ///
        data_point#Sex_AA2#Pre_LTCH ///
        if Sex_AA2!=2, ///
        rep(data_point)
    
     margins, over(Pre_LTCH Sex_AA2 data_point) saving(`n', replace)

    Any help is greatly appreciated.
    Last edited by Elyse Cottrell; 22 Oct 2019, 08:12.

  • Dave Airey
    replied
    I don't think that is what was being asked here. For example the mean for rep78==2 is the mean of the dummy variable for that level. There are 8 out of 69 that are rep78==2 and 8/69 = .115942.

    Leave a comment:


  • Alan Neustadtl
    replied
    How about using estat summarize after anova?

    Code:
    sysuse auto
    anova mpg rep78
    estat summarize
    Code:
    . sysuse auto
    (1978 Automobile Data)
    
    . anova mpg rep78
    
                             Number of obs =         69    R-squared     =  0.2348
                             Root MSE      =    5.28971    Adj R-squared =  0.1869
    
                      Source | Partial SS         df         MS        F    Prob>F
                  -----------+----------------------------------------------------
                       Model |  549.41578          4   137.35394      4.91  0.0016
                             |
                       rep78 |  549.41578          4   137.35394      4.91  0.0016
                             |
                    Residual |  1790.7871         64   27.981049  
                  -----------+----------------------------------------------------
                       Total |  2340.2029         68   34.414749  
    
    . estat summarize
    
      Estimation sample anova                  Number of obs =         69
    
      -------------------------------------------------------------------
          Variable |         Mean      Std. Dev.         Min          Max
      -------------+-----------------------------------------------------
               mpg |     21.28986      5.866408           12           41
                   |
             rep78 |
                2  |      .115942      .3225009            0            1
                3  |     .4347826      .4993602            0            1
                4  |     .2608696      .4423259            0            1
                5  |     .1594203      .3687494            0            1
      -------------------------------------------------------------------
    
    .

    Leave a comment:


  • Elyse Cottrell
    replied
    Awesome that was perfect. Thank you so much, I really appreciate it!

    Originally posted by Dave Airey View Post
    If you wanted summary statistics by group, you could do something like below. You have to be careful about whether you want model statistics or descriptive statistics though, depending on the model and data.

    Code:
    webuse manuf
    // anova yield temp chem temp#chem meth temp#meth chem#meth temp#chem#meth
    egen group = group(temp chem meth), label
    tabstat yield, by(group) s(N mean SD)

    Leave a comment:


  • Dave Airey
    replied
    If you wanted summary statistics by group, you could do something like below. You have to be careful about whether you want model statistics or descriptive statistics though, depending on the model and data.

    Code:
    webuse manuf
    // anova yield temp chem temp#chem meth temp#meth chem#meth temp#chem#meth
    egen group = group(temp chem meth), label
    tabstat yield, by(group) s(N mean SD)

    Leave a comment:

Working...
X