Announcement

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

  • contrast command after mi estimate

    I am running a logistic model on multiply-imputed data, and one of the covariates I include in the model has multiple categories. The Stata output after running the model produces coefficients and significance values for each category, but I would like to obtain a p value for the covariate as a whole. I have previously used the contrast command which has worked well in non-mi data, but this appears not to work on mi data, as with the code below. Any advice on how I can do this?
    Code:
    mi estimate: logit outcome variable_a variable_b
    contrast variable_b
    Error code is produced: "requested action not valid after most recent estimation command"


    Many thanks in advance


  • #2
    If you want a joint test, use mi test. Here is an example

    Code:
    . // example data
    . webuse mheart1s20
    (Fictional heart attack data; BMI missing)
    
    . 
    . // create categorical predictor
    . generate age_cat = irecode(age, 35, 45, 55, 65)
    
    . 
    . // logit model
    . mi estimate : logit attack i.age_cat bmi i.female
    
    Multiple-imputation estimates                   Imputations       =         20
    Logistic regression                             Number of obs     =        154
                                                    Average RVI       =     0.0260
                                                    Largest FMI       =     0.1212
    DF adjustment:   Large sample                   DF:     min       =   1,321.47
                                                            avg       = 106,533.13
                                                            max       = 509,383.50
    Model F test:       Equal FMI                   F(   6,131614.8)  =       1.82
    Within VCE type:          OIM                   Prob > F          =     0.0908
    
    ------------------------------------------------------------------------------
          attack | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
         age_cat |
              1  |   .3141378   1.345188     0.23   0.815     -2.32244    2.950715
              2  |   .8507624   1.296884     0.66   0.512    -1.691131    3.392656
              3  |   .7430001   1.319771     0.56   0.573    -1.843772    3.329772
              4  |   1.631275   1.311714     1.24   0.214    -.9396832    4.202233
                 |
             bmi |   .0960174   .0462712     2.08   0.038     .0052444    .1867905
        1.female |  -.0860744   .3979733    -0.22   0.829    -.8660895    .6939408
           _cons |  -3.568647   1.868242    -1.91   0.056    -7.231645    .0943514
    ------------------------------------------------------------------------------
    
    . 
    . // joint test
    . mi test 1.age_cat 2.age_cat 3.age_cat 4.age_cat 
    note: assuming equal fractions of missing information.
    
     ( 1)  [attack]1.age_cat = 0
     ( 2)  [attack]2.age_cat = 0
     ( 3)  [attack]3.age_cat = 0
     ( 4)  [attack]4.age_cat = 0
    
           F(  4,745085.1) =    1.83
                Prob > F =    0.1195

    Comment

    Working...
    X