Announcement

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

  • doubt on longitudinal dataset - xtdescribe

    Hello,

    I have a longitudinal dataset with 5 waves. I used the command xtdescribe and I found out that have a total of 66689 individuals. Then I tried to find the number of individuals by sex (xtdescribe if sex==1 and xtdescribe if sex==2) .
    the results were that I have a total of 31341 males and 35381 females. When I add these values the result was 66723 (and not 66689). I inspect the variable sex and I only have two missing observations. Can you please help me with an explanation for this? I send an example of the dataset below. Thank you very much in advance.


    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long(pidp pid) byte sex
    22445 10127798 2
    22445 10127798 2
    22445 10127798 2
    22445 10127798 2
    29925 10192697 2
    29925 10192697 2
    29925 10192697 2
    76165 10689869 2
    76165 10689869 2
    76165 10689869 2
    223725 11926929 1
    280165 12430439 2
    280165 12430439 2
    280165 12430439 2
    280165 12430439 2
    280165 12430439 2
    333205 12908843 2
    333205 12908843 2
    333205 12908843 2
    387605 13361163 2
    387605 13361163 2
    469205 13857142 2
    469205 13857142 2
    541285 14396769 1
    541285 14396769 1
    541965 14396793 2
    599765 14757249 2
    599765 14757249 2
    599765 14757249 2
    665045 15270041 1
    665045 15270041 1
    665045 15270041 1
    732365 15752658 1
    732365 15752658 1
    760925 16095227 1
    813285 16441141 1
    813285 16441141 1
    850005 16714296 1
    956765 17401356 1
    987365 17624592 2
    1558565 36791768 2
    1587125 17870879 2
    1587125 17870879 2
    1587125 17870879 2
    1697285 42526507 1
    1731965 45754268 1
    1833965 50832336 1
    1833965 50832336 1
    1833965 50832336 1
    1833965 50832336 1
    2067205 65313828 1
    2270525 76446336 2
    2270525 76446336 2
    2292285 77065891 1
    2297045 77185978 1
    2626845 93565895 1
    2670365 94533008 2
    2853965 96577029 2
    2853965 96577029 2
    2853965 96577029 2
    2888645 96949503 2
    2888645 96949503 2
    2932845 97515191 1
    3229325 106197851 2
    3424485 113800185 2
    3565925 118692798 2
    3568645 118692895 1
    3587685 118781707 1
    3587685 118781707 1
    3663845 119065835 1
    3663845 119065835 1
    3663845 119065835 1
    3667245 119074613 2
    3667245 119074613 2
    3667245 119074613 2
    3667245 119074613 2
    3705325 119277506 2
    3705325 119277506 2
    3705325 119277506 2
    3705325 119277506 2
    3705325 119277506 2
    3914085 127440488 2
    3914765 127440518 1
    3915445 127440534 2
    3916125 127440569 2
    4091565 135447429 1
    4091565 135447429 1
    4091565 135447429 1
    4192205 141158735 2
    4454005 154358304 1
    4454005 154358304 1
    4454005 154358304 1
    4454005 154358304 1
    4454005 154358304 1
    4473725 154588539 1
    4473725 154588539 1
    4473725 154588539 1
    4562125 159615704 1
    4626045 164246088 1
    4626045 164246088 1
    end
    label values pid pid
    label values sex c_sex
    label def c_sex 1 "male", modify
    label def c_sex 2 "female", modify
    [/CODE]


  • #2
    Continuing last question: I send again the example of the dataset with an additional variable: wave
    Thank you very much in advance



    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long(pidp pid) byte sex float wave
      22445  10127798 2 2
      22445  10127798 2 3
      22445  10127798 2 4
      22445  10127798 2 5
      29925  10192697 2 3
      29925  10192697 2 4
      29925  10192697 2 5
      76165  10689869 2 3
      76165  10689869 2 4
      76165  10689869 2 5
     223725  11926929 1 3
     280165  12430439 2 1
     280165  12430439 2 2
     280165  12430439 2 3
     280165  12430439 2 4
     280165  12430439 2 5
     333205  12908843 2 3
     333205  12908843 2 4
     333205  12908843 2 5
     387605  13361163 2 2
     387605  13361163 2 3
     469205  13857142 2 4
     469205  13857142 2 5
     541285  14396769 1 1
     541285  14396769 1 2
     541965  14396793 2 1
     599765  14757249 2 2
     599765  14757249 2 4
     599765  14757249 2 5
     665045  15270041 1 1
     665045  15270041 1 2
     665045  15270041 1 5
     732365  15752658 1 4
     732365  15752658 1 5
     760925  16095227 1 5
     813285  16441141 1 2
     813285  16441141 1 3
     850005  16714296 1 3
     956765  17401356 1 1
     987365  17624592 2 1
    1558565  36791768 2 1
    1587125  17870879 2 3
    1587125  17870879 2 4
    1587125  17870879 2 5
    1697285  42526507 1 4
    1731965  45754268 1 2
    1833965  50832336 1 1
    1833965  50832336 1 2
    1833965  50832336 1 3
    1833965  50832336 1 4
    2067205  65313828 1 3
    2270525  76446336 2 3
    2270525  76446336 2 4
    2292285  77065891 1 1
    2297045  77185978 1 2
    2626845  93565895 1 4
    2670365  94533008 2 1
    2853965  96577029 2 1
    2853965  96577029 2 2
    2853965  96577029 2 3
    2888645  96949503 2 1
    2888645  96949503 2 4
    2932845  97515191 1 1
    3229325 106197851 2 5
    3424485 113800185 2 5
    3565925 118692798 2 2
    3568645 118692895 1 3
    3587685 118781707 1 3
    3587685 118781707 1 4
    3663845 119065835 1 2
    3663845 119065835 1 3
    3663845 119065835 1 4
    3667245 119074613 2 2
    3667245 119074613 2 3
    3667245 119074613 2 4
    3667245 119074613 2 5
    3705325 119277506 2 1
    3705325 119277506 2 2
    3705325 119277506 2 3
    3705325 119277506 2 4
    3705325 119277506 2 5
    3914085 127440488 2 5
    3914765 127440518 1 5
    3915445 127440534 2 1
    3916125 127440569 2 5
    4091565 135447429 1 1
    4091565 135447429 1 2
    4091565 135447429 1 3
    4192205 141158735 2 1
    4454005 154358304 1 1
    4454005 154358304 1 2
    4454005 154358304 1 3
    4454005 154358304 1 4
    4454005 154358304 1 5
    4473725 154588539 1 1
    4473725 154588539 1 2
    4473725 154588539 1 3
    4562125 159615704 1 1
    4626045 164246088 1 1
    4626045 164246088 1 2
    end
    label values pid pid
    label values sex c_sex
    label def c_sex 1 "male", modify
    label def c_sex 2 "female", modify

    Comment


    • #3
      Ana:
      I cannot replicate your problem:
      Code:
      . xtdescribe
      
          pidp:  22445, 29925, ..., 4626045                        n =         50
          wave:  1, 2, ..., 5                                      T =          5
                 Delta(wave) = 1 unit
                 Span(wave)  = 5 periods
                 (pidp*wave uniquely identifies each observation)
      
      Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                               1       1       1         2         3       5       5
      
           Freq.  Percent    Cum. |  Pattern
       ---------------------------+---------
             10     20.00   20.00 |  1....
              6     12.00   32.00 |  ....1
              4      8.00   40.00 |  ..1..
              4      8.00   48.00 |  ..111
              3      6.00   54.00 |  .1...
              3      6.00   60.00 |  111..
              3      6.00   66.00 |  11111
              2      4.00   70.00 |  ...1.
              2      4.00   74.00 |  ...11
             13     26.00  100.00 | (other patterns)
       ---------------------------+---------
             50    100.00         |  XXXXX
      
      . xtdescribe if sex==1
      
          pidp:  223725, 541285, ..., 4626045                      n =         25
          wave:  1, 2, ..., 5                                      T =          5
                 Delta(wave) = 1 unit
                 Span(wave)  = 5 periods
                 (pidp*wave uniquely identifies each observation)
      
      Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                               1       1       1         1         2       4       5
      
           Freq.  Percent    Cum. |  Pattern
       ---------------------------+---------
              4     16.00   16.00 |  ..1..
              4     16.00   32.00 |  1....
              2      8.00   40.00 |  ....1
              2      8.00   48.00 |  ...1.
              2      8.00   56.00 |  .1...
              2      8.00   64.00 |  11...
              2      8.00   72.00 |  111..
              1      4.00   76.00 |  ...11
              1      4.00   80.00 |  ..11.
              5     20.00  100.00 | (other patterns)
       ---------------------------+---------
             25    100.00         |  XXXXX
      
      . xtdescribe if sex==2
      
          pidp:  22445, 29925, ..., 4192205                        n =         25
          wave:  1, 2, ..., 5                                      T =          5
                 Delta(wave) = 1 unit
                 Span(wave)  = 5 periods
                 (pidp*wave uniquely identifies each observation)
      
      Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                               1       1       1         2         3       5       5
      
           Freq.  Percent    Cum. |  Pattern
       ---------------------------+---------
              6     24.00   24.00 |  1....
              4     16.00   40.00 |  ....1
              4     16.00   56.00 |  ..111
              2      8.00   64.00 |  .1111
              2      8.00   72.00 |  11111
              1      4.00   76.00 |  ...11
              1      4.00   80.00 |  ..11.
              1      4.00   84.00 |  .1...
              1      4.00   88.00 |  .1.11
              3     12.00  100.00 | (other patterns)
       ---------------------------+---------
             25    100.00         |  XXXXX
      
      .
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment

      Working...
      X