Announcement

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

  • linear mixed models

    Hi all,
    I am using linear mixed models (xtmixed) to analyse data from a randomized controlled trial. However, I need to adjust for some correlated data in the analysis because some of my participants are twins. Does anybody know which command or how I can do this? I have tried 'vce (cluster)' command but it did not work. I used this before in logits and clogits commands.
    Help is really really appreciated

  • #2
    You didn't get a quick answer. You'll increase your chances of a helpful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex.

    mixed has replace xtmixed. You should look at it - it provides some options on random effect and error covariance structures.

    Comment


    • #3
      Thanks Phil. Perhaps if I provide the codes I currently have in delimiters this could help? Again, I am looking at a way of adjusting for correlated data (twin data) in a randomised controlled trial:

      xtmixed lbp group##time || id:,
      contrast group##time
      margins group##time

      margins time, at(group=0) pwcompare(effects)
      margins time, at(group=1) pwcompare(effects)

      contrast group@time, effect


      Help is really appreciated guys! We are in the middle of some very important analysis for this RCT

      Comment


      • #4
        It sounds like you have an RCT where some participants are twins, and some are not. I assume you had a family ID for each participant, such that twins will share a family ID and singles will be nested within their own family ID. You don't show your command with the cluster option, but did you type either of the following?

        Code:
        mixed lbp group##time || id:, vce(cluster family_id)
        mixed lbp group##time || family_id: || person_id:
        If you had this setup, then mechanically, either should produce an estimate - although I don't know how well the clustered VCE works if most of your clusters are 1 or 2. Nor do I know how substantively valid the estimates are if you're nesting person within family, and many families have one person. If you tried this, then can you report the exact error message? "Did not work" is not informative enough to help, as indicated in the FAQ.

        I am not really how familiar with how dyadic data is handled substantively. You might want to Google this.
        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


        • #5
          Dear Weiwen
          Thanks for your answer. Really appreciate it.

          I do have a general participant id and another 'idtwin' to identify twins (where twins in a pair have the same id number), and non-twins have a single number identifier. Here is the original command I had including marginns commands:

          [CODE]xtmixed lbp group##time || id:,
          contrast group##time
          margins group##time
          [contrast time@group, effect
          margins time, at(group=0) pwcompare(effects)
          margins time, at(group=1) pwcompare(effects)
          contrast group@time, effect/CODE]

          with the VCE (cluster idtwin) command I do get the following error message:
          option VCE() not allowed

          However, I have tried inserting the idtwin variable before the general overall particpant id, hoping that this is what you suggested:
          Code:
          xtmixed lbp group##time || idtwin: || id:,
          And Statta did produce Random effects estimates for idtwins and id.

          But I am not sure if the margins and contrast effects are adjusted? Or even how to produce margins and contrast effects for twins and non-twins.

          Thanks again, it appears some progress here, maybe we are getting close.



          Comment


          • #6
            Dear Weiwen et al

            I can now get estimates using the vce (cluster idtwin) command which is great.
            However, I still can not produce estimates of treatment comparisons separated for twins and non-twins using the contrast and margins commands.
            I tried the 'if' command as follows:

            Code:
            contrast group@time, effect if twinstatus==1
            and the error message:
            option if not allowed
            r(198);

            Again any help is appreciated, getting almost there

            Comment

            Working...
            X