Announcement

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

  • How to measure the Intraclass correlation coefficients

    Dears,

    I have a panel dataset.

    Company ID: Company
    Year
    Dependent variable: ROA
    Independent variable= Accounting Experience (AccExp) of CEO
    Person ID: CEOIDs

    I want to calculate the Intraclass correlation coefficients, could any one help me in this?


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str12 Company float Year double ROA float AccExp str12 CEOIDs
    "000002" 2010   .06255212677231026 1 "3053716" 
    "000002" 2011  .023492560689115115 1 "3053716" 
    "000002" 2012  .051224944320712694 1 "3053716" 
    "000002" 2013   .04344919786096257 1 "3053716" 
    "000002" 2014  .030564784053156147 1 "3053716" 
    "000002" 2015   .03143313798614811 1 "3053716" 
    "000002" 2016   .05271398747390397 1 "3053716" 
    "000002" 2017   .05558388577256502 0 "3053716" 
    "000002" 2018   .02774049217002237 0 "30192166"
    "000002" 2019  .020512820512820513 0 "30192166"
    "000002" 2020   .02368421052631579 0 "30192166"
    "000002" 2021   .03558718861209965 0 "30192166"
    "000004" 2011  .021479713603818614 0 "30138572"
    "000004" 2012  .012690355329949238 0 "30138572"
    "000004" 2013   .00954653937947494 0 "30257424"
    "000004" 2014   .06553398058252427 0 "30257424"
    "000004" 2015  .015463917525773196 0 "30257424"
    "000004" 2016   .04555808656036447 0 "30257424"
    "000004" 2017   .03333333333333333 0 "30257424"
    "000004" 2020  .046052631578947366 0 "30344026"
    "000004" 2021   .06838709677419355 0 "30344026"
    "000005" 2013  .012195121951219513 0 "3091370" 
    "000005" 2014   .04455445544554455 0 "3091370" 
    "000005" 2015  .030894308943089432 0 "3091370" 
    "000005" 2016  .044657097288676235 0 "3091370" 
    "000005" 2017   .02100840336134454 0 "3091370" 
    "000005" 2018  .009140767824497258 0 "3091370" 
    "000005" 2019  .009191176470588236 0 "3091370" 
    "000005" 2020  .015841584158415842 0 "3091370" 
    "000006" 2010  .013807285546415981 0 "30145990"
    "000006" 2011   .08067226890756303 0 "30145990"
    "000006" 2012   .09943714821763602 0 "30145990"
    "000006" 2013   .05714285714285714 0 "3079234" 
    "000006" 2014   .03586206896551724 0 "3079234" 
    "000006" 2018  .034818941504178275 0 "30366949"
    "000006" 2019    .0267515923566879 0 "30366949"
    "000006" 2020   .05193075898801598 0 "30258380"
    "000006" 2021   .04015544041450777 0 "30258380"
    "000007" 2012   .03860294117647059 0 "3055274" 
    "000007" 2013  .009380863039399626 0 "3055274" 
    "000007" 2015  .005037783375314861 0 "30142622"
    "000007" 2016   .03488372093023256 0 "30142622"
    "000008" 2013  -.04216867469879518 0 "3092478" 
    "000008" 2015   .05307262569832402 0 "30258038"
    "000008" 2016   .05574912891986063 0 "30324183"
    "000008" 2017   .07224770642201835 0 "30324183"
    "000008" 2018   .10775047258979206 0 "30324183"
    "000008" 2019   .07314814814814814 0 "30324183"
    "000008" 2020   .02977667493796526 0 "30324183"
    "000008" 2021   .09728506787330317 0 "30313965"
    "000009" 2010   .08469055374592833 0 "30164062"
    "000009" 2012   .07975460122699386 0 "30164062"
    "000009" 2013   .07407407407407407 0 "30164062"
    "000009" 2014  .058465286236297195 0 "30164062"
    "000009" 2015   .05502846299810247 0 "30164062"
    "000009" 2016   .05163511187607573 0 "30164062"
    "000009" 2017  .037996545768566495 0 "30164062"
    "000009" 2018   .03634085213032581 0 "30164062"
    "000009" 2019   .03468208092485549 0 "30164062"
    "000010" 2013   .02533783783783784 0 "30262523"
    "000010" 2014  .017892644135188866 0 "30262523"
    "000010" 2015   .05172413793103448 0 "30262523"
    "000010" 2016   .04007285974499089 0 "30262523"
    "000010" 2017  .045774647887323945 0 "30262523"
    "000010" 2018   .03801652892561983 0 "30383026"
    "000010" 2020  .016985138004246284 0 "30407648"
    "000010" 2021    .0647985989492119 0 "30407648"
    "000011" 2011  .050699300699300696 0 "3062824" 
    "000011" 2012   .07441860465116279 0 "3062824" 
    "000011" 2013   .04751131221719457 0 "3062824" 
    "000011" 2014  .016483516483516484 0 "3062824" 
    "000011" 2015   .01978021978021978 0 "3062824" 
    "000011" 2016   .04182509505703422 0 "3062824" 
    "000011" 2017   .03488372093023256 0 "3062824" 
    "000011" 2018  .028933092224231464 0 "3066194" 
    "000011" 2019  .057746478873239436 0 "3066194" 
    "000011" 2020              .028125 0 "3066194" 
    "000011" 2021   .03959131545338442 0 "3066194" 
    "000012" 2014   .04779411764705882 0 "3047844" 
    "000012" 2015  .054820415879017016 0 "3047844" 
    "000012" 2017   .05673758865248227 0 "30365356"
    "000012" 2018  .057803468208092484 0 "30330803"
    "000012" 2019   .06679764243614932 0 "30330803"
    "000012" 2020    .0821917808219178 0 "30330803"
    "000012" 2021   .14655172413793102 0 "30330803"
    "000014" 2010 -.005405405405405406 0 "3054726" 
    "000014" 2011  -.03571428571428571 0 "3054726" 
    "000014" 2012   .04564315352697095 0 "3054726" 
    "000014" 2013   .07871720116618076 0 "3053560" 
    "000014" 2014  .022988505747126436 0 "3053560" 
    "000014" 2015  .026694045174537988 0 "3053560" 
    "000014" 2016  .036334913112164295 0 "3053560" 
    "000014" 2017   .03938730853391685 0 "3053560" 
    "000014" 2018   .03171953255425709 0 "3053560" 
    "000014" 2019   .04789272030651341 0 "3053560" 
    "000014" 2020    .0297951582867784 0 "3050228" 
    "000014" 2021  .024013722126929673 0 "3050228" 
    "000016" 2013   .13561847988077497 0 "3044154" 
    "000016" 2014    .0913884007029877 0 "3044154" 
    "000016" 2016  .038910505836575876 0 "3044154" 
    end
    format %ty Year

  • #2
    Originally posted by Em Mohamed View Post
    I have a panel dataset . . .

    I want to calculate the Intraclass correlation coefficients. . .
    If you're fitting a mixed model with CEO nested within company, then maybe something like the following, which will give you two intraclass correlation coefficients.
    Code:
    version 18.0
    
    clear *
    
    quietly input str12 Company float Year double ROA float AccExp str12 CEOIDs
    <redacted for brevity>
    end
    
    *
    * Begin here
    *
    quietly compress
    
    // Some checks
    preserve
    contract Company CEOIDs
    isid CEOIDs
    restore
    
    // Cleanup
    quietly destring _all, replace
    foreach var of varlist _all {
        rename `var' `=strlower(substr("`var'", 1, 3))'
    }
    
    mixed roa i.(yea acc) || com: || ceo: , nogroup nolrtest nolog
    estat icc
    
    exit
    Attached Files

    Comment


    • #3
      Originally posted by Joseph Coveney View Post
      If you're fitting a mixed model with CEO nested within company, then maybe something like the following, which will give you two intraclass correlation coefficients.
      Code:
      version 18.0
      
      clear *
      
      quietly input str12 Company float Year double ROA float AccExp str12 CEOIDs
      <redacted for brevity>
      end
      
      *
      * Begin here
      *
      quietly compress
      
      // Some checks
      preserve
      contract Company CEOIDs
      isid CEOIDs
      restore
      
      // Cleanup
      quietly destring _all, replace
      foreach var of varlist _all {
      rename `var' `=strlower(substr("`var'", 1, 3))'
      }
      
      mixed roa i.(yea acc) || com: || ceo: , nogroup nolrtest nolog
      estat icc
      
      exit
      Thanks so much. When I run the commands I get this

      . isid CEOIDs
      variable CEOIDs does not uniquely identify the observations
      r(459);

      Comment


      • #4
        Is it possible that some CEOs have that position in more than one company? That would indicate that either 1) you have a data problem because you know that no CEOs worked for different companies or 2) that this is indeed the case and you have cross-classified data. Assuming that you can eliminate #1, you would change Joseph's syntax as follows:
        Code:
        mixed roa i.(yea acc) || _all: R.com || ceo: , nogroup nolrtest nolog
        Unfortunately, estat icc doesn't work after running a cross-classified model, so you will have to compute the ICCs yourself. See here.
        Last edited by Erik Ruzek; 09 Apr 2024, 12:41. Reason: Edited syntax - the grouping variable with the smallest sample size (unique clusters) should be the one with the _all: R. syntax.

        Comment


        • #5
          Originally posted by Erik Ruzek View Post
          Is it possible that some CEOs have that position in more than one company? That would indicate that either 1) you have a data problem because you know that no CEOs worked for different companies or 2) that this is indeed the case and you have cross-classified data. Assuming that you can eliminate #1, you would change Joseph's syntax as follows:
          Code:
          mixed roa i.(yea acc) || _all: R.com || ceo: , nogroup nolrtest nolog
          Unfortunately, estat icc doesn't work after running a cross-classified model, so you will have to compute the ICCs yourself. See here.
          Thanks for your reply, but I got the message when I run this command
          // Some checks preserve contract Company CEOIDs isid CEOIDs restore For the data, the CEO may change across firms and years.

          Comment


          • #6
            This means that you don't have perfect nesting of CEOs within companies. Companies changing CEOs during the panel period is another form of cross-classification. The model syntax I provided in #4 is appropriate for your data.

            Comment

            Working...
            X