Announcement

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

  • Summary Statistics

    Greetings Everyone!

    Hopefully, you will be fine, I have a dummy variable Family CEO, -I want summary statistics of both the categories of dummy variables i.e summary statistics of family CEOs coded with 1 and non-family CEOs coded with 0 for my data. How would I will do that?

    Kindly guide me in this regard.

    My data is as follows,
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte(familyceo familycfo ceoexp ceoduality firmauditedbybig4) int firmage float(ROA leverage FSize GROWTH)
    1 0 . 0 0 32   1.459615  .6678604  7.668056         .
    1 0 . 0 0 33  -7.754289  .6067408  7.261759  3.054217
    1 0 . 0 0 34          .         .         .         .
    1 0 . 0 0 35   -8.80937  .4181014  7.164674         .
    1 0 . 0 0 36  .25011736 .45187625  7.217708  .6899911
    1 0 . 0 0 37   3.831065  .5182462   7.38139  .8478552
    0 0 0 0 1 63   19.89492 .21250607  9.529928         .
    0 0 1 0 1 63   19.89492 .21463886  9.710406  .9301814
    0 0 1 0 1 63   19.89492 .21250607  9.778219  .9051874
    0 0 1 0 1 63   19.89492 .25370887  9.864554  .8964928
    0 0 1 0 1 63   19.89492  .3474259  9.917455  .8778219
    0 0 1 0 1 63  12.098378  .3556304  9.940432   .985522
    0 0 . 0 0 30   3.164827  .7846099  8.184522         .
    0 0 . 0 0 31   -8.80937   .910777   8.06464  .5994081
    0 0 . 0 0 32   -8.80937  .9236114  8.022999 4.0967345
    0 0 . 0 0 33  -6.127638  .9236114  7.958175 1.4421222
    0 0 . 0 0 34   -8.80937  .9236114  7.938602  2.514825
    0 0 . 0 0 35  -6.362999  .8580823  8.310107  .7753903
    1 0 0 1 0 22 -1.7192656  .6652378   8.14824         .
    0 0 . 0 0 23 -3.2373226 .57061285  7.844554  1.294626
    0 0 . 0 0 24   7.366319  .4672839  7.735307  .7518582
    0 0 . 0 0 25 -.14124398  .7162448 8.3098955  1.762861
    0 0 . 0 0 26 -.07025166  .6959535  8.216352  .4916485
    0 0 . 0 0 27  -4.469071    .47768  8.778835  1.625662
    1 0 . 0 0 28   3.908297  .6691024  6.680208         .
    1 0 . 0 0 29   1.857098  .5940771  6.490783 1.2480315
    1 0 . 0 0 30  1.9604052 .49459785  6.373218  .9451178
    1 0 . 0 0 31  -3.821005  .5233763  6.373218 1.4368476
    1 0 . 0 0 32   -8.80937  .6072503  6.373218 3.9577906
    1 0 . 0 0 33   -8.80937  .8332708  6.373218 2.8359556
    0 0 1 0 1 33  13.014237 .21250607  8.039464         .
    0 0 1 0 1 34   19.89492 .21250607  8.173347  .6416053
    0 0 1 0 1 35  18.970385 .21250607  8.232238  .8549759
    0 0 1 0 1 36  19.466335 .21250607  8.333967 1.0178238
    0 0 1 0 1 37  17.775503 .21250607  8.377935  .9254964
    0 0 1 0 1 38  17.249828 .21250607  8.448696  .8582649
    0 0 0 0 1 55   -8.80937  .8003521 10.759789         .
    0 0 1 0 1 56  -7.516587  .8591401 10.759789  .7888702
    0 0 . 0 1 57 -3.6039126  .9080115 10.759789  .4299975
    0 0 . . 1 58  -8.231997  .9236114 10.759789  2.319735
    0 0 . 0 1 59  -7.876342  .9236114 10.740938  .7834263
    0 0 1 0 0 60  -1.404496  .8447106 10.759789   .372364
    0 0 0 0 0 25  2.2452927  .4854042  8.198164         .
    0 0 0 0 0 26  -1.921782  .4668746  8.207247  1.224217
    0 0 0 0 0 27  .23675595 .47850555  8.209219  .9401861
    0 0 0 0 0 28   .2322288  .5353287   8.32279  .8519874
    0 0 0 0 0 29  1.5040905 .55433726  8.369829  .7831377
    0 0 0 0 0 30   2.717768 .59114134  8.467881  .7119889
    0 0 1 0 1 15  -2.511726  .8443624  9.697705         .
    0 0 1 0 1 15   -8.80937  .8167302  9.638017  .9754818
    0 0 1 0 1 15  -1.249461  .8270376  9.639021   .985204
    0 0 1 0 1 15   4.851413  .6315141  9.808291  .6844545
    0 0 1 0 1 15   9.378237  .5842944  9.924554  .7446014
    0 0 1 0 1 15   -1.26006  .7327657 10.396075  .9344124
    0 0 1 0 1 15  17.075975  .3470866  8.287368         .
    0 0 0 0 1 15          .         .         .  .9948369
    0 0 1 0 1 15  14.846066  .3408561 8.6568165  .8658588
    0 0 1 0 1 15  10.669405  .3241286  8.650183  .9789823
    0 0 1 0 1 15   9.325613 .21644107 9.0378475 1.0358547
    0 0 1 0 1 15          .         .         .         .
    0 0 0 0 0 23   8.826463 .49371645  8.388728         .
    0 0 . 0 0 24  15.698702  .3681829  8.168033  .9409341
    0 0 . 0 0 25   15.83402 .29515263  8.105588 1.0126767
    0 0 . 0 0 26  4.0019803  .5149329  8.550848 1.0875539
    0 0 . 0 0 27   19.89492  .3589711  8.631696  .7108834
    0 0 . 0 0 28   18.73228  .4967346  8.766024 1.0459486
    1 0 0 0 0 46   -8.80937  .9236114  8.559438         .
    1 0 0 0 0 47   -8.80937  .9236114  8.462826 1.9834975
    1 0 0 0 0 48   -8.80937  .9236114  8.377414         .
    1 0 0 0 0 49  -8.137987  .9236114  8.293559         .
    1 0 0 0 0 50 -1.3095858  .9236114  7.815776         .
    1 0 0 0 0 51   -5.59072  .9236114  7.717165         .
    0 0 0 0 1 31   19.89492 .21250607 9.2092085         .
    0 0 0 0 1 32   19.89492 .21250607  8.764783  .9112272
    0 0 0 0 1 33   19.89492 .27664977    8.4434  .7964498
    0 0 0 0 1 34   19.89492  .6385494  8.679538  .6411182
    0 0 0 0 1 35   19.89492  .7981861  8.822537  .9741348
    0 0 0 0 1 36   19.89492  .8349503  8.608017 1.3845043
    1 0 0 0 1 45   1.160986  .6246384  8.789524         .
    1 0 0 0 0 46   3.092305  .6332455  8.874778 1.1051954
    1 0 0 0 0 47  3.2294085   .609208   8.85407  .8597001
    1 0 0 0 0 48  -1.332969  .7230148  9.160687 1.1750988
    1 0 0 0 0 49  -2.577426    .68208   9.15288   .759365
    1 0 0 0 0 50   4.937258   .661628  9.132781  .9722548
    . . . . 1 15   4.791622  .5250776  7.512246         .
    0 0 1 1 1 15   3.826842  .3260834  8.383708  .8903771
    0 0 1 1 1 15   6.872365 .23133583  8.512298  .7228909
    0 0 1 0 1 15  -.1420071  .3481553   8.66932     1.078
    0 0 1 0 1 15  -.2942775  .3985448  8.901327 1.1904831
    0 0 1 0 1 15  3.0737975  .3928256  8.932312 1.2827805
    1 0 1 0 1 56   3.493249  .2982024  7.010952         .
    0 0 1 0 0 57  -4.987038  .3384683  7.036983   1.23194
    0 0 1 0 0 58  -2.645522 .37328205  7.206051  1.051406
    0 0 1 0 0 59  -2.538368  .3618834  7.143128  .8510298
    0 0 1 0 0 60   2.648612  .3908854  7.214931   .906648
    0 0 1 0 0 61  -.4464564  .4778426  7.642673 1.0372677
    0 0 1 0 1 19   19.89492 .26621428   8.65854         .
    0 0 1 0 1 20  2.2178755 .21250607  8.571435   1.22401
    0 0 1 0 1 21  18.719685  .2179374  8.674351  .8938115
    0 0 1 0 1 22   19.89492 .26749927  8.778236  .9885384
    end
    label values ceoduality CEOD
    label def CEOD 0 "Chairperson & CEO are not the Same Person", modify
    label def CEOD 1 "Chairperson & CEO are the Same Person", modify
    label values firmauditedbybig4 BIG4
    label def BIG4 0 "Not Audited by BIG4", modify
    label def BIG4 1 "Audited by BIG4", modify
    Thanks in Advance.

  • #2
    There are more than one way, a few suggestions are:

    Code:
    * 1) Use if:
    sum leverage FSize if familyceo == 0
    sum leverage FSize if familyceo == 1
    
    * 2) Use bysort:
    bysort familyceo: sum leverage FSize
    
    * 3) Use tabstat:
    tabstat leverage FSize, stat(n mean sd) by(familyceo) miss

    Comment


    • #3
      Originally posted by Ken Chui View Post
      There are more than one way, a few suggestions are:

      Code:
      * 1) Use if:
      sum leverage FSize if familyceo == 0
      sum leverage FSize if familyceo == 1
      
      * 2) Use bysort:
      bysort familyceo: sum leverage FSize
      
      * 3) Use tabstat:
      tabstat leverage FSize, stat(n mean sd) by(familyceo) miss
      Thanks Dear Chui

      Comment


      • #4
        Originally posted by Ken Chui View Post
        There are more than one way, a few suggestions are:

        Code:
        * 1) Use if:
        sum leverage FSize if familyceo == 0
        sum leverage FSize if familyceo == 1
        
        * 2) Use bysort:
        bysort familyceo: sum leverage FSize
        
        * 3) Use tabstat:
        tabstat leverage FSize, stat(n mean sd) by(familyceo) miss
        Could you guide us of how to carry out t-test of the same variables.

        Thanks in Advance

        Comment


        • #5
          Could you guide us of how to carry out t-test of the same variables.
          Sure, use this to learn more about the command. There are examples provided to you at the bottom of the technical page as well:
          Code:
          help ttest

          Comment


          • #6
            Originally posted by Sattar Khan View Post

            Could you guide us of how to carry out t-test of the same variables.

            Thanks in Advance
            Code:
            qui {
            
                
            local vars leverage FSize
            log using ttest.txt, replace
                foreach var of local vars {
                    ttest `var', by (familyceo)
                        noi di    " `var'  & "  %10.3fc r(mu_1) " & " %10.3fc r(sd_1) " & " ///
                        %10.3fc r(mu_2) " & " %10.3fc r(sd_2) " & " ///
                        %10.3fc r(mu_1)-r(mu_2) " & " %10.3fc r(p)
                }
            }
            cap log close
            Output:

            leverage & 0.497 & 0.248 & 0.673 & 0.178 & -0.176 & 0.002
            FSize & 8.778 & 0.924 & 7.748 & 0.986 & 1.030 & 0.000

            Comment


            • #7
              Originally posted by Ken Chui View Post

              Sure, use this to learn more about the command. There are examples provided to you at the bottom of the technical page as well:
              Code:
              help ttest
              Okay Dear Thank You

              Comment

              Working...
              X