Announcement

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

  • Multilevel crossed interaction for factor variable

    Dear all
    I'm working in Stata 14.2.
    I'm doing a two-level logit model with melogit. I'm interested in a cross-level interaction between the variable win (first level) and the variable camp (second level).
    I think in this case, I have to take the first level variable in the random part of the model. Is this right?
    Because win ist a factor variable i need the R. notation.
    In the Stata manuals the .R notation ist normally used with the _all option. But this option takes all cluster together. I don't understand why this should makes sense.
    So my question is what ist the difference between the following models? and which one should I take?

    Code1
    . melogit entscheid i.win##i.wissen i.win##i.prä i.win##i.Wirtschaft age i.educ i.sex i.lang i.win##c.camp || _all: R.win, cov(unstructured) intpoints(30)

    Code2 with group identity variable
    melogit entscheid i.win##i.wissen i.win##i.prä i.win##i.Wirtschaft i.win##ib2.zukunft age i.educ i.sex i.lang i.win##c.camp || idnr:R.win, covariance(unstructured) intpoints(30)

    idnr ist the identifying variable.

    And why is there only one var(_cons) in the output? Should not be there a variance for each category of win?

  • #2
    I think in this case, I have to take the first level variable in the random part of the model. Is this right?
    No, it's not right. The terminology can be confusing. The random part of the Stata syntax is a place where you list the levels at which you need random intercepts, and also those variables for which you need random slopes. But the fact that a particular variable is defined at some higher level does not necessitate placing it in the random part of the model. In fact, if you place a variable in the random part of the model at the same level for which it is defined, the model will be unidentifiable and fail to converge! The way to get the interaction of win with camp is just i.win##i.camp in the fixed part of the model, the same as other interaction terms you already have. Your attempt to place win into the random part of the Stata syntax would be interpreted by Stata as an attempt to get random slopes on the indicators for the levels of win--which has nothing to do with interacting win and camp. The placement of win in the random part would create an interaction: but it would be the interaction of win with idnr (in Code 2)--which, again, is not what you want.

    Comment

    Working...
    X