Announcement

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

  • Constraints in mixed models

    I am manually implementing the likelihood ratio test for multiply imputed data by Meng and Rubin (1992). I am using it for testing variance components in a 3-components mixed model, using the command -mixed-. In one step in the implementation I have to constrain parameters of the mixed model. However, constraints are not allowed in -mixed-. Therefore, I have used -gllamm-, but -gllamm- is extremely slow for my particular application (which results in weeks of computation time for all the testing that I need to do). Do anyone have suggestions for alternative (user-written) commands that might allow me to constrain parameters in a mixed model?

    Update: I am talking about constraining the fixed effects part of the model (coefficient parameters), not the random part of the model (which is easy to do in -mixed-)
    Last edited by Kristian Karlson; 03 Mar 2016, 01:47.

  • #2
    It is true that -mixed- does not support constraints. But certain types of constrained estimation are still possible. If the constraints you are interested in are simple linear constraints on the coefficients (of the kind that could be evaluated with -lincom-), you can use -test- for those constraints with the -coef- option. The -coef- option causes test to display the results of the estimation command with the tested hypotheses applied as constraints. Here's a silly example:

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . mixed price mpg headroom || rep78:
    
    Performing EM optimization: 
    
    Performing gradient-based optimization: 
    
    Iteration 0:   log likelihood = -639.64794  
    Iteration 1:   log likelihood = -639.52861  
    Iteration 2:   log likelihood = -639.49659  
    Iteration 3:   log likelihood = -639.49636  
    Iteration 4:   log likelihood = -639.49636  
    
    Computing standard errors:
    
    Mixed-effects ML regression                     Number of obs     =         69
    Group variable: rep78                           Number of groups  =          5
    
                                                    Obs per group:
                                                                  min =          2
                                                                  avg =       13.8
                                                                  max =         30
    
                                                    Wald chi2(2)      =      18.77
    Log likelihood = -639.49636                     Prob > chi2       =     0.0001
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             mpg |  -243.1092   57.80687    -4.21   0.000    -356.4086   -129.8099
        headroom |  -288.1991   397.4693    -0.73   0.468    -1067.225    490.8264
           _cons |    12186.4   2050.482     5.94   0.000      8167.53    16205.27
    ------------------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
      Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
    rep78: Identity              |
                      var(_cons) |   1.39e-15   2.76e-14      1.59e-32    120.7598
    -----------------------------+------------------------------------------------
                   var(Residual) |    6571478    1118803       4707008     9174476
    ------------------------------------------------------------------------------
    LR test vs. linear model: chibar2(01) = 0.00          Prob >= chibar2 = 1.0000
    
    . test mpg = headroom, coef
    
     ( 1)  [price]mpg - [price]headroom = 0
    
               chi2(  1) =    0.01
             Prob > chi2 =    0.9051
    
    
    Constrained coefficients
    
    ------------------------------------------------------------------------------
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    price        |
             mpg |  -241.2675   55.70562    -4.33   0.000    -350.4485   -132.0865
        headroom |  -241.2675   55.70562    -4.33   0.000    -350.4485   -132.0865
           _cons |    12006.4   1387.829     8.65   0.000     9286.302    14726.49
    -------------+----------------------------------------------------------------
    lns1_1_1     |
           _cons |  -17.10617   9.950729    -1.72   0.086    -36.60924    2.396902
    -------------+----------------------------------------------------------------
    lnsig_e      |
           _cons |   7.849125   .0851257    92.21   0.000     7.682281    8.015968
    ------------------------------------------------------------------------------
    You can also use this method to apply several constraints simultaneously using the -accum- option of -test-. See -help test- for more details if needed.

    But this won't work for non-linear constraints.

    Comment


    • #3
      Kristian may be able to use meglm, here is an example.

      Code:
      webuse pig, clear
      constraint 1 _b[weight:week] = 5
      meglm weight week || id:, constraints(1)

      Comment


      • #4
        I would assume another potential option would be to use gsem to fit the model as a multilevel model in an SEM context, but am not completely sure how many levels it would support.

        Comment


        • #5
          Thanks guys. These are all excellent suggestions. As I have to compute the log-likelihood value with the coefficeint constraints (as part of the Meng-Rubin test), I am going for the -meglm-. I had, to be frank, never heard about this command before, but this is exactly what I need. So, many thanks to Rafal for this suggestion. This will speed up my program 100-fold.

          Comment

          Working...
          X