Announcement

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

  • devide siblings into younger and older pairs (with MZ and DZ twins as well)

    Hello, I am working on the panel data (I am analyzing wave 1 only). The data I have look like below;

    aid famid age pair sibc11 gender

    10316654 2147 15 HSMF158 HS male
    10316655 1569 12 HSMF138 HS male
    10316656 1045 12 HSMF002 HS female
    10316657 3326 16 HSFF041 HS female
    10316668 1658 16 HSMM010 HS male
    10316669 3036 13 FSMF381 FS male
    10316610 3193 14 HSMF172 HS male
    10316611 3193 14 HSMF174 HS female

    aid - Identification number
    famid - family identification number
    age - age of a child
    pair - unique pair identification number (e.g., HSMF half siblings male/female; FSMF full siblings male/female)
    sibc11 - classify all sibling pair (e.g., HS - half-siblings; FS - full siblings; MZ - monozygotic; DZ - dizygotic)

    My questions follow:
    1. I'd like to divide siblings into younger and older siblings by gender (e.g., younger female, younger male, older female, older male).
    I've looked through this webpage and based on the comments already posted here, I've tried the following commands;

    gen male_age = age if gender == 0
    gen female_age = age if gender == 1
    rangestat (count) younger_boys = male_age younger_girls = female_age, ///
    interval(age.-1) by (famid) /* using "famid" seems not adequate)

    replace younger_boys = o if missing(younger_boys)
    replace younger_girs = 0 if missing(younger_girls)

    The outcome follows;

    gen male_age = age if gender == 0
    (13,488 missing values generated)
    gen female_age = age if gender == 1
    (13,143 missing values generated)

    interval(age.-1) by (famid) /* using "famid" seems not adequate)

    replace younger_boys = o if missing(younger_boys)
    (7,352 real chages made)
    replace younger_girs = 0 if missing(younger_girls)
    (7,352 real changes made)


    aid famid age pair sibc11 gender male_age female_age younger_boys younger_girls

    10316654 2147 15 HSMF158 HS male 15 0 2326 2746
    10316655 1569 12 HSMF138 HS male 12 0 4975 5452
    10316656 1045 12 HSMF002 HS female 0 12 0 0
    10316657 3326 16 HSFF041 HS female 0 16 2326 2746
    10316668 1658 16 HSMM010 HS male 16 0 0 0
    10316669 3036 13 FSMF381 FS male
    10316610 3193 14 HSMF172 HS male
    10316611 3193 14 HSMF174 HS female


    ***my problem is that the size of siblings is only around 3,159 out of 21,xxx so it doesn't make sense to have 7352 real changes here.
    The outcome also looks very weird. How can I have 2326 for younger_boys?


    Could you please help me how to fix this problem? I've tried to use some other variables--instead of using "famid"--, but it doesn't solve this problem)
    What should I do?

    Thanks in advance,
    ~Young







    Last edited by young ju chae; 16 Jul 2020, 15:32.

  • #2
    Welcome to Stata list. You will increase your chances of useful answer by following the FAQ on asking questions – right Stata code in code delimiters, readable Stata output, and sample data using dataex.

    You will also increase your chances of useful answer with a shorter posting.

    If you only analyze one wave, you really are doing cross-sectional rather than panel analysis.

    You probably have a logic error somewhere. The way to find it is to do the analysis on a small number of observations that include all the conditions and then look very carefully at what's happening. You may need to trace this by each statement to see what has gone wrong.

    Comment


    • #3
      aid famid pair sibcl1 age gender
      1000001 1701 FSMM281 FS 11 male
      1000002 1702 FSMM282 FS 13 male
      1000003 1703 FSFF283 FS 17 female
      1000004 1704 FSFF284 FS 19 female
      1000006 1705 FSMF285 FS 12 male
      I provide the sample data here - aid - identification number; famid - family identification number; pair - identify each pair (e.g., FSMMxxx = full sibling male/male identification number); sibcl1 - the type of the pair (e.g., FS - full sibling)

      Q1. how to divide siblings into older and brother sibling and younger and brother sibling?
      Q2. how to divide siblings into older and sister sibling and younger and sister sibling?

      The sample data only represents wave 1 but I will eventually combine wave 1 through wave 3. At this point, I'd like to identify how to create older brother siblings and younger brother siblings pairs (and older sister siblings and younger sister siblings pairs).

      Your help will be highly appreciated.
      ~Young
      Last edited by young ju chae; 18 Jul 2020, 12:59.

      Comment

      Working...
      X