Announcement

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

  • Longitudinal analysis with melogit

    Dear all,

    I have a longitudinal dataset with 600 patients (variable pid) who had an doctors appointment every year once for five years (variable year) and every year it was noticed if the patient took an antidepressant (variable antidepressant), thus I have 3000 observations.

    I want to answer the question if the antidepressant intake changed over the years independantly from sex.

    My idea was to use one of the following formulas:

    Code:
    meqrlogit antidepressant year sex || pid:year
    melogit antidepressant year sex || pid:year
    But, unfortunately STATA is crushing when I run the code. Is this the wrong approach or is the code incorrect?

    Thanks for your help in advance.
    Kind regards, Martin


  • #2
    When you say Stata is crashing, what, specifically is happening? Are you getting any output at all? Any error messages? Is it hanging? Does it actually crash the computer (i.e. you have to reboot the machine to get it going again)? If you are getting any output or error messages, please show them.

    Also since this is just a two-level model, have you tried -xtset pid year- and then -xtlogit antidepressant year sex, re-? It's the same model estimated by meqrlogit and melogit, although the estimation algorithm is different. Sometimes this one goes smoothly when the mixed effects logits fail.

    Comment


    • #3
      Try
      Code:
      assert inlist(antidepressant, 0, 1) if !missing(antidepressant)
      melogit antidepressant i.year i.sex || pid:
      If you want random intercepts for each year (I'm not sure that I would recommend it: see Clyde's xtlogit model—it doesn't / can't), then review the help file and user's manual for the command, in particular, the R. syntax for factor variables in random effects equations of me estimation commands.

      If you want to account for the longitudinal nature of the dataset, then you could also consider a marginal (GEE) model with a specified correlation structure as an alternative, for example,
      Code:
      xtset pid year
      xtgee antidepressant i.year i.sex, family(binomial) link(logit) corr(unstructured)
      These sometimes are difficult to fit, but with a balanced dataset and 600 observations, you should be able to obtain convergence.

      I'm not sure that your model, with just the main effects of year and sex, will allow you "to answer the question if the antidepressant intake changed over the years independently from sex". You might want to consider adding a term for the interaction of sex and time to address whether the time course of the presence of a prescription for one or more antidepressant drugs in the patient's medical records (I doubt that you're actually monitoring intake) varies by year independently of the patient's sex. A model with not only the main effects but also their interaction should better allow you to assess whether the prescription rate changes over year, whether it differs by sex and whether any change in the rate over time depends upon the patient's sex.
      Last edited by Joseph Coveney; 15 Oct 2017, 23:05.

      Comment


      • #4
        Dear Clyde, dear Joseph,

        sorry for not specifying the crashing. It just stopped after Grid node 7.


        messagen.png


        All of your proposed solutions work perfectly!

        Thank you very much for the fast help!

        Comment

        Working...
        X