Announcement

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

  • Multilevel Multinomial logistic regression with group-level variables

    Hello, I am trying Multilevel Multinomial logistic regression with gsem command.
    However, there's a little confusion for me.
    I read the page about multilevel sem for stata, but I have no idea how to control group-level variables.

    My data is nested in individual-country level.
    Outcome(t4est) has 4 different categories so that I want to compare one category to another.


    gsem (i.test <- tvtot tvpol acetalv ndfegcf dfegcon lrscale threat socialdi diff22 FOREIGNB GDP agea i.female i.minority educ i.married i.city secgen unempex i.manlbr hinctnta M1[cntry]@1), mlogit


    but I am afraid I might have to specify that FOREIGNB and GDP are also group-level variable.
    besides, when I try that code, following note appears and it doesn't give the result....


    note: The following observed variable names will be treated as latent variables:
    FOREIGNB, GDP. If this is not your intention, use the nocapslatent option, or
    identify the latent variable names in the latent() option.

    Fitting fixed-effects model:

    Iteration 0: log likelihood = -10069.483
    Iteration 1: log likelihood = -9545.854
    Iteration 2: log likelihood = -9498.9158
    Iteration 3: log likelihood = -9498.6617
    Iteration 4: log likelihood = -9498.6617

    Refining starting values:

    Grid node 0: log likelihood = -9314.5082

    Fitting full model:



    What could be the cause?
    Thanks a lot


  • #2
    By default, Stata assumes that any variable name starting with a capital letter is a latent variable, or one whose existence isn't directly measured but is inferred from its relationship to other variables. That's why the error message highlighted the two names. You can, however, fix this easily:

    Code:
    gsem (i.test <- tvtot tvpol acetalv ndfegcf dfegcon lrscale threat socialdi diff22 FOREIGNB GDP agea i.female i.minority educ i.married i.city secgen unempex i.manlbr hinctnta M1[cntry]@1), mlogit nocapslatent latent(M1)
    You have to explicitly specify all latent variables, and the only one is M1 - the random intercept.

    In any sort of hierarchical model, if you have a variable that varies on the level of one of the groups, but you only want a fixed effect for it, then you just include it in the model as you've already done.

    A quick minor point: if GDP is denominated in raw dollars, then the resulting coefficient is probably going to be very small. GDP is usually in the billions of dollars at the very least, and you would be modeling the log odds for each dollar increase in GDP, so you're probably going to see a log odds very close to zero, and it may even cause convergence trouble. I'd try converting GDP to, say, billions of dollars.
    Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

    When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

    Comment


    • #3
      I think there are two issues here.

      First, -gsem- by default treats any variable whose name begins with an upper case letter as a latent variable--even if there is an observed variable by that same name in your data set. Foreign and gdp are presumably not latent variables in your model, as they are easily observed. So you either need to rename them to lower case, or specify the -nocapslatent- option to override the default behavior. Stata's note tells you that, and it means exactly what it says.

      Second, there is no difference, syntactically, in the way one specifies individual and group level variables in these multi-level models. They are all just put into the varlist of the command. It is the fact that these variables are constant within groups that gives them their group-level character and nothing more need be said. You specify group-level variables exactly the same way you specify any other variable in these models. The only problem you have here is due to the unfortunate choice of using upper case letters to start their names.

      You have probably seen examples of multi-level models in Stata that have something like -multi_level_modeling_command y x1 x2 x3 || group: x1-, and I know that people often mistakenly suppose this means that x1 is being specified as a group level variable. But that is not the case. This syntax specifies that there is a cross-level interaction between group and x1. And, in fact, it will not work if x1 is a group level variable! It only works if x1 is defined at some other level than group itself.
      Last edited by Clyde Schechter; 06 Feb 2019, 13:47. Reason: Added: Crossed with #2.

      Comment


      • #4
        Thanks a lot!! It was a great help!!!

        Comment

        Working...
        X