Announcement

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

  • Constraints with crossed random effects in meglm

    Hi all,

    I'm attempting to estimate the size (Cohen's f-squared) of a fixed effect in a crossed-random-effects model using meglm. Per the guidance here, after running the full model containing all effects, I tried to run a reduced model omitting the effect whose size I'd like to estimate -- while constraining the random intercepts to be the same as in the full model. The problem that I'm running into is that, while I can constrain the second random intercept in the reduced model, I can't seem to constrain the first one. Here's what I see:


    Full model:

    meglm prejudice group_ideo status choice age gender r_* education income if ideo < 0 || _all: R.group || caseid:, coeflegend

    ...

    ----------------------------------------------------------------------------------
    prejudice | Coef. Legend
    -----------------+----------------------------------------------------------------
    group_ideo | .3505744 _b[group_ideo]
    status | -.0520157 _b[status]
    choice | .0785236 _b[choice]
    age | -.0174924 _b[age]
    gender | -.0317336 _b[gender]
    r_black | -.0153226 _b[r_black]
    r_latino | -.0161411 _b[r_latino]
    r_asian | -.0213594 _b[r_asian]
    r_other | -.0020795 _b[r_other]
    education | .1457378 _b[education]
    income | -.0353673 _b[income]
    _cons | .3821728 _b[_cons]
    -----------------+----------------------------------------------------------------
    _all>group |
    var(_cons)| .0095322 _b[/var(_cons[_all>group])]
    -----------------+----------------------------------------------------------------
    caseid |
    var(_cons)| .0173583 _b[/var(_cons[caseid])]
    -----------------+----------------------------------------------------------------
    var(e.prejudice)| .036905 _b[/var(e.prejudice)]
    ----------------------------------------------------------------------------------



    Setting constraints:

    constraint 1 _b[/var(_cons[_all>group])] = .0095322
    constraint 2 _b[/var(_cons[caseid])] = .0173583



    Reduced model (omitting group_ideo, whose effect size I'm estimating):

    meglm prejudice status choice age gender r_* education income if ideo < 0 || _all: R.group || caseid:, constraints(1 2) coeflegend

    ...

    ( 1) [/]var(_cons[caseid]) = .0173583 [Here's the second constraint; where is the first?]
    ----------------------------------------------------------------------------------
    prejudice | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -----------------+----------------------------------------------------------------
    status | -.0240033 .0394749 -0.61 0.543 -.1013727 .0533661
    choice | .1014771 .0279125 3.64 0.000 .0467697 .1561845
    age | -.0154582 .0553281 -0.28 0.780 -.1238992 .0929828
    gender | -.018527 .0250571 -0.74 0.460 -.067638 .030584
    r_black | -.0374703 .0388945 -0.96 0.335 -.113702 .0387614
    r_latino | -.0198336 .0677155 -0.29 0.770 -.1525536 .1128864
    r_asian | -.0256533 .0624194 -0.41 0.681 -.147993 .0966864
    r_other | -.0046783 .0693498 -0.07 0.946 -.1406015 .1312449
    education | .1304237 .0716898 1.82 0.069 -.0100858 .2709331
    income | -.0426562 .0493371 -0.86 0.387 -.1393551 .0540428
    _cons | .3906323 .0350027 11.16 0.000 .3220283 .4592362
    -----------------+----------------------------------------------------------------
    _all>group |
    var(_cons)| .0231686 .0072097 .0125897 .0426365
    -----------------+----------------------------------------------------------------
    caseid |
    var(_cons)| .0173583 (constrained)
    -----------------+----------------------------------------------------------------
    var(e.prejudice)| .0405366 .0022036 .0364397 .045094
    ----------------------------------------------------------------------------------



    So the caseid intercept is successfully constrained in the reduced model, but the _all>group intercept is freely estimated for some reason. Does anyone have any insights into why I get this behavior? Note that I'm pulling the parameter name for the first intercept, _b[/var(_cons[_all>group])], directly from the output of the first model.

    Thanks in advance for any help!


    Eric
    Last edited by Eric Knowles; 06 Dec 2017, 07:02.

  • #2
    Eric found a bug in meglm.

    meglm internally imposes default constraints on the variance-covariance structure of the random effects that, in certain cases, may take precedence over constraints specified in the constraints() option.

    We will fix this bug in a future update; in the meantime, Eric can make meglm recognize his constraints by adding an independent covariance structure to the _all equation:

    Code:
    meglm prejudice ... || _all: R.group, cov(independent) || caseid:, constraints(1 2)
                                        ^^^^^^^^^^^^^^^^^^

    Comment


    • #3
      [Please disregard the message below! I made a mistake in the command -- i.e., placed "cov(independent)" in the wrong place. Corrected, the command constrains both random effects. Thank you.]


      Hi Rafal,

      Thanks very much for this solution. It worked for the reduced model: both random effects were successfully constrained. However, as part of the effect size calculation, I still need to run a null model:

      meglm prejudice if ideo > 0 || _all: R.group || caseid:, cov(independent) constraints(1 2)

      ...

      ( 1) [/]var(_cons[caseid]) = .0132763
      ----------------------------------------------------------------------------------
      prejudice | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      -----------------+----------------------------------------------------------------
      _cons | .4085577 .0354129 11.54 0.000 .3391498 .4779656
      -----------------+----------------------------------------------------------------
      _all>group |
      var(_cons)| .0269817 .0081924 .0148807 .0489235
      -----------------+----------------------------------------------------------------
      caseid |
      var(_cons)| .0132763 (constrained)
      -----------------+----------------------------------------------------------------
      var(e.prejudice)| .042269 . . .
      ----------------------------------------------------------------------------------



      For some reason, setting the cov(independent) option didn't work for this model -- that is, the first random effect is still unconstrained. Any ideas why?

      Thanks again,

      Eric
      Last edited by Eric Knowles; 06 Dec 2017, 12:47.

      Comment

      Working...
      X