Announcement

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

  • Don't understand what marginsplot is doing.

    I have run a simple regression model followed by a request for margins as follows:

    Code:
    . regScores ib3.Time##ib2.Group
    command regScores is unrecognized
    r(199);
    
    . reg Scores ib3.Time##ib2.Group
    
          Source |       SS           df       MS      Number of obs   =        42
    -------------+----------------------------------   F(5, 36)        =      0.57
           Model |  71.5570238         5  14.3114048   Prob > F        =    0.7250
        Residual |  909.384167        36  25.2606713   R-squared       =    0.0729
    -------------+----------------------------------   Adj R-squared   =   -0.0558
           Total |   980.94119        41  23.9253949   Root MSE        =     5.026
    
    --------------------------------------------------------------------------------
            Scores |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
              Time |
                1  |     -.7875      2.513    -0.31   0.756      -5.8841      4.3091
                2  |     1.5875      2.513     0.63   0.532      -3.5091      6.6841
                   |
       1.GroupCorE |      1.125    2.71435     0.41   0.681    -4.379957    6.629957
                   |
    Time#GroupCorE |
              1 1  |   1.770833   3.838671     0.46   0.647    -6.014351    9.556018
              2 1  |   .4458333   3.838671     0.12   0.908    -7.339351    8.231018
                   |
             _cons |     56.275   1.776959    31.67   0.000     52.67116    59.87884
    --------------------------------------------------------------------------------
    
    . margins Time##GroupCorE
    
    Predictive margins                              Number of obs     =         42
    Model VCE    : OLS
    
    Expression   : Linear prediction, predict()
    
    --------------------------------------------------------------------------------
                   |            Delta-method
                   |     Margin   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
              Time |
                1  |   56.72857   1.343255    42.23   0.000     54.00432    59.45282
                2  |   58.53571   1.343255    43.58   0.000     55.81147    61.25996
                3  |   56.75714   1.343255    42.25   0.000      54.0329    59.48139
                   |
         GroupCorE |
                1  |   58.40556   1.184639    49.30   0.000       56.003    60.80812
                2  |   56.54167   1.025928    55.11   0.000     54.46099    58.62234
                   |
    Time#GroupCorE |
              1 1  |   58.38333   2.051856    28.45   0.000     54.22198    62.54469
              1 2  |    55.4875   1.776959    31.23   0.000     51.88366    59.09134
              2 1  |   59.43333   2.051856    28.97   0.000     55.27198    63.59469
              2 2  |    57.8625   1.776959    32.56   0.000     54.25866    61.46634
              3 1  |       57.4   2.051856    27.97   0.000     53.23864    61.56136
              3 2  |     56.275   1.776959    31.67   0.000     52.67116    59.87884
    --------------------------------------------------------------------------------
    
    . marginsplot
    
      Variables that uniquely identify margins: Time GroupCorE
    .
    In the resulting plot, I get this:

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	27.2 KB
ID:	1502270


    I don't understand why I have the GroupCorE=asobserved and I don't understand how to get \rid of it.
    Richard T. Campbell
    Emeritus Professor of Biostatistics and Sociology
    University of Illinois at Chicago

  • #2
    Well, your variable GroupCorE takes on two values, 1, and 2. And the two curves on the graph labeled accordingly show you the expected value of Scores at each time for each of those conditions. The curve for GroupCorE = asobserved gives you the expected value at each time not conditional on GroupCorE. That is, it is giving you what what you would have gotten with -margins time- followed by -marginsplot-.

    If you don't want that one included, I think you will get what you want with -margins Time#GroupCorE- (note single #, not double ##) followed by -marginsplot-.

    Comment


    • #3
      Thanks Clyde, exactly what I want.. It reminds me of one of the best lines I ever read in the acknowledgements for a book: "When you don't know what you're doing it's good to have friends who do."
      Richard T. Campbell
      Emeritus Professor of Biostatistics and Sociology
      University of Illinois at Chicago

      Comment


      • #4
        Happy to count you as a friend!

        Comment


        • #5
          Originally posted by Clyde Schechter View Post

          If you don't want that one included, I think you will get what you want with -margins Time#GroupCorE- (note single #, not double ##) followed by -marginsplot-.
          I ended up here after a Google search. So, one more thank you, Clyde!

          Comment

          Working...
          X