Announcement

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

  • I need some help about the crossed-classified multilevel logistic regression syntax

    Hello,

    I'm working with a dataset in the LONG shape to do some longitudinal analysis. The analysis of interest is the multilevel, because it can consider the repeated measures dependency (paired data) and the envirnonment in the model. So I have three levels in my model (observations, individuals, census tract). Well, I observed that there was some individuals who moved from one census tract to another between the period of the study, so I found that I can't use the traditional nested model, and have to use the crossed model that can consider this characteristic of change.

    Can someone help me about the syntax of this kind of model?

    Here is the exemple of my data set:

    id time census_t sex age education outcome
    100600311 1 1006 2 58.43394934976044 2 1
    100600311 2 1006 2 63.62217659137577 3 1
    100600511 1 1006 1 56.139630390143736 3 0
    100600511 2 1006 1 61.42915811088296 3 0
    100600811 1 1006 2 28.95003422313484 3 .
    100600811 2 1032 2 34.7460643394935 3 1
    100601211 1 1006 2 81.056810403833 1 0
    100601211 2 1006 2 86.65571526351813 1 0
    100604312 1 1006 1 38.965092402464066 2 0
    100604312 2 1006 1 44.2984257357974 3 1
    100604811 1 1006 2 68.70636550308008 1 1
    100604811 2 1006 2 74.03422313483915 1 1
    100604911 1 1006 1 30.17932922655715 2 1
    100604911 2 1006 1 35.43052703627652 3 1
    100604912 1 1006 2 26.38740588637919 2 1
    100604912 2 1006 2 31.668720054757017 3 1
    202500911 1 2025 1 57.97672826830938 3 0
    202500911 2 2025 1 64.03559206023272 3 0
    202501011 1 2025 2 56.42436687200548 4 0
    202501011 2 2025 2 62.40109514031485 4 1
    202501612 1 2025 1 62.29158110882957 4 1
    202501612 2 22278 1 68.34770704996578 4 1



  • #2
    [code] me_command outcome_var fixed_effects || _all: R.census_t || id: [code]

    That said, if your full data set has only a small number of people who switch census tracts, and if the data set is large enough that the crossed-effects (actually, multiple membership) model runs very slowly or fails to converge, you might consider eliminating the problem by removing observations from the data set so as to leave only one census tract per person. This could be done by dropping observations from all but the most frequently mentioned census tract for each person, or, if there are two or more census tracts that a person lives in equally often (or nearly so), retaining one selected at random.

    Comment


    • #3
      Hi Clyde! Thank you very much for clarify this matter and provide the syntax.

      Can I ask you one more question that I have? What happens to the data if I use the traditional nested model? For exemplo, in the dataset that I have, I ran the command

      [code] melogit outcome fixed_effects || census_t || id:, or [code]

      and the output gave me the exact total census_t units (n=279), but gave me more individuals than we actually have in our dataset (sample=1431 and in this model id=1585). Do you know why this happen? Because I can't find an axplanation to this matter. I suspect that the analysis is considering more individual because some of them have two values of census tract.

      Comment


      • #4
        I suspect that the analysis is considering more individual because some of them have two values of census tract.
        Yes, that is exactly what is happening. The very meaning of "nested" is that id 1 in census_t X is to be considered as a different person from id1 in census_t Y. So people who moved are being double counted.

        Comment


        • #5
          Perfect! It helped me a lot. I appreciated you attention on this matter!

          Kind regards,

          Comment

          Working...
          X