Announcement

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

  • -collect style showbase off- not working with -mixed- command

    Hello,

    The command collect style showbase off doesn't seem to work with a mixed-effects linear regression.

    Code:
    use https://www.stata-press.com/data/r18/exercise.dta
    keep if inlist(day, 0, 4, 6, 8, 12)
    
    collect clear
    collect _r_b _r_ci _r_p: mixed strength i.program##i.day || id:,

    Next is the code to that produces the subsequent table.
    Code:
    collect layout (colname) (result)
    
    collect style row stack, spacer nobinder delimiter(" X ")
    collect style cell, nformat(%5.2f)
    collect style cell result[_r_ci], sformat("(%s)") cidelimiter(", ")
    collect style cell result[_r_p], nformat("%5.3f")
    collect style cell result, halign(center)
    collect style cell, border(right, pattern(nil))
    collect preview
    
    -----------------------------------------------------------------------------------------------
                                                                 Coefficient     95% CI     p-value
    -----------------------------------------------------------------------------------------------
    1 = reps increase; 2 = weights increase                                                        
      1                                                              0.00                          
      2                                                              1.36    (-0.82,  3.54)  0.222 
                                                                                                   
    Day of measurement                                                                             
      0                                                              0.00                          
      4                                                              1.12     (0.41,  1.84)  0.002 
      6                                                              1.37     (0.64,  2.10)  0.000 
      8                                                              1.49     (0.76,  2.22)  0.000 
      12                                                             1.64     (0.91,  2.37)  0.000 
                                                                                                   
    1 = reps increase; 2 = weights increase X Day of measurement                                   
      1 X 0                                                          0.00                          
      1 X 4                                                          0.00                          
      1 X 6                                                          0.00                          
      1 X 8                                                          0.00                          
      1 X 12                                                         0.00                          
      2 X 0                                                          0.00                          
      2 X 4                                                         -0.18    (-1.14,  0.77)  0.710 
      2 X 6                                                          0.20    (-0.76,  1.16)  0.680 
      2 X 8                                                          0.10    (-0.87,  1.07)  0.844 
      2 X 12                                                         0.16    (-0.84,  1.17)  0.750 
                                                                                                   
    var(_cons)                                                      10.22     (6.41, 16.29)        
                                                                                                   
    var(e)                                                           1.06     (0.84,  1.35)        
                                                                                                   
    Intercept                                                       79.69    (78.04, 81.33)  0.000 
    -----------------------------------------------------------------------------------------------
    I then added
    Code:
    collect style showbase off
    collect preview
    but the resulting table continues to show the base levels for the main effects of factor (categorical) variables and interaction terms.

    I know I can specify the predictors in the model that I want to present in a table as shown below, but would like to why collect style showbase off isn't working as I expected.
    Code:
    . collect levelsof colname
    
    Collection: default
     Dimension: colname
        Levels: 1.program 2.program 0.day 4.day 6.day 8.day 12.day 1.program#0.day 1.program#4.day 1.program#6.day 1.program#8.day
                1.program#12.day 2.program#0.day 2.program#4.day 2.program#6.day 2.program#8.day 2.program#12.day var(_cons) var(e) c1
                _cons
    
    . collect layout (colname [2.program 4.day 6.day 8.day 12.day 2.program#4.day 2.program#6.day 2.program#8.day 2.program#12.day]) (result)
    Kind regards,
    Suzanna

  • #2
    With the recent change to mixed for collect, the base levels are incorrectly getting flagged as empty. A short-term work-around is to use
    Code:
    collect style showempty off
    We hope to fix this in a future Stata update.

    Comment


    • #3
      Thanks Jeff. I'll use your work-around in the meantime.

      Comment

      Working...
      X