Announcement

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

  • Identifying twins that have a feature in common

    Hi all,

    I am working with a dataset that contains information on a number of twins. At least one of the twins in each pair has disease X and I am trying to work out whether this disease has a strong genetic component. One thing that I need to do is create a variable that identifies concordant (i.e. those that both have the disease) and discordant (i.e. those in which only one twin has the disease) pairs.

    Each individual comes with a unique number to identify their twin pair, a number to identify them within the pair (1 or 2), and a variable indicating whether or not they have the disease (0 or 1).

    Can anyone suggest a way in which I could create a variable that highlights concordant and discordant twins?

    Any help would be very welcome!

    David

  • #2
    David,

    I think something like the following untested code should work:

    Code:
    bysort twin_pair_id: egen maxX=max(hasX)
    bysort twin_pair_id: egen minX=min(hasX)
    gen cordant=0
    replace cordant=1 if maxX==minX
    Best,
    Devra
    Devra Golbe
    Professor Emerita, Dept. of Economics
    Hunter College, CUNY

    Comment


    • #3
      Consider

      -bysort twinid : gen both = x[1] == 1 & x[2] == 1

      Also search for Tip 71 on dyads in the Stata Journal

      Comment

      Working...
      X