Announcement

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

  • Xtmixed. Clustered errors (random effects) for ego and alter.

    Hello Statalist,

    In summary my original dataset had individual data on 5,230 professors from a university (95% of their faculty population) and their scientific production from 2000-2019, scrapped from their electronic CVs. I have identified all potential and actual ties among professors within that university based on their journal papers, books and conference papers coauthorship and turned the dataset into a dyadic format. For this regression, my dependent variable is tie formation (binary). I have kept all ties=1 and randomly selected 5% of the total sample of potential non formed ties, ending up with a tie sample of over 6 million (Kleinbaum, Stuart, and Tushman (2013) sampling method). The homophilly tie variables are "same origin" (binary, non-inbred vs inbred scholar), "same gender" (binary), "same field" (binary), "ygroup" (categorical, block of 4 years of scientific collaboration) and "degree" (continuous). My ego (A) and alter (P) variables are "non-native", "female", "age", "yexperience", "abroad" (binary, international experience), "postdoc" (continuous, number of postdoc researcher in the science team), "phD", "master", "undergrad", "n_papers", "nbooks", "n_book_chapters", "n_conf_papers", "i.field" (7 field dummies). Now I want to include clustered errors (random effects) for ego and alter in the model, similar to Cameron, Gelbach & Miller (2006) and Dahlander & McFarland (2013). I tried doing both, but xtmixed only accepted to cluster at the ego level. I have not yet found a way to run two-way cluster-robust standard errors.

    This is the model that worked clustering only at the ego level.

    xtmixed tie non_native_A non_native_P female_A female_P age_A age_P yexperience_A yexperience_P ///
    abroad_A abroad_P postdoc_A postdoc_P phd_A phd_P master_A master_P underg_A underg_P ///
    n_papers_A n_papers_P nbooks_A nbooks_P n_book_chapters_A n_book_chapters_P ///
    n_conf_papers_A n_conf_papers_P i.field_n_A i.field_n_P degree_A degree_P ///
    same_origin same_field same_gender i.ygroup || egoID: , vce(cluster egoID) ///
    mle covariance(unstructured) variance

    Now I want to run it again with clustered errors (random effects) for ego and alter. What would I have to adapt from the previous model to make it work?

    P.S.: It is my first time posting a question in this forum, but this has been extremely useful in the 4 years of my PhD, so thank you all for your guidance throughout my studies.
    Last edited by Luis Grochocki; 20 Jul 2020, 15:41.

  • #2
    Hi Luis,

    This is a multidisciplinary forum, and I suspect that most are not familiar with your jargon. I can only speak for myself of course, but I do not know what is meant by ego and alter. I will try to answer your questions as best I can, but I may be misunderstanding you.

    A few things:
    1) As per the Stata FAQ, you should tell us what version of Stata you are using. xtmixed is an old command. The new command is
    Code:
    mixed
    for linear regressions and
    Code:
    melogit
    for regressions with binary outcomes.
    2) Since you have a binary outcome, you should probably use a logit or probit model. melogit will work just fine.
    3) You mentioned you have dyads. My experience is that the panel group is the dyad id in these regression designs. Is that what egoID denotes?
    4) You should probably cluster at the dyadic level.

    Comment


    • #3
      Dear Chris,

      Thank you for your reply, sorry for not clarifying the meaning of ego and alter. With ego networks, each respondent is seen as the centre of his or her own network. This respondent is referred to as an ‘ego’ and its immediate contacts as ‘alters’ (Prell, Christina. Social Network Analysis (p. 118). SAGE Publications.) So each row of my data is a tie, a 0 was given for potential ties and a 1 for real ties. Each row has information on the tie characteristics and on each ego (actor) and alter (partner) that is part of that one tie.

      I ran my regressions with both xtmixed and mixed, as recommended in "Egocentric Network Analysis" (Perry, Pescosolido & Borgatti, 2018), and they gave the same results. I also ran using melogit, as you suggested, and the results are shown below. I still have not found a way to run two-way cluster-robust standard errors on ego and alter. I have tried using the command "vce2way" and the new version "vcemway", but they give the error message "if not allowed" r(101). Does anyone know how to do a two-way cluster in a Multilevel model?

      Thank you


      Code:
      melogit tie non_native_A non_native_P female_A female_P age_A age_P yexperience_A yexperience_P ///
      abroad_A abroad_P postdoc_A postdoc_P phd_A phd_P master_A master_P underg_A underg_P ///
      n_papers_A n_papers_P nbooks_A nbooks_P n_book_chapters_A n_book_chapters_P ///
      n_conf_papers_A n_conf_papers_P i.field_n_A i.field_n_P degree_A degree_P ///
      same_origin same_field same_gender i.ygroup || egoID: , vce(cluster egoID)

      HTML Code:
      Mixed-effects logistic regression               Number of obs     =    4912929
      Group variable:           egoID                 Number of groups  =      5,219
      
                                                      Obs per group:
                                                                    min =        165
                                                                    avg =      941.4
                                                                    max =      1,143
      
      Integration method: mvaghermite                 Integration pts.  =          7
      
                                                      Wald chi2(47)     =   47678.07
      Log pseudolikelihood = -201126.83               Prob > chi2       =     0.0000
                                        (Std. Err. adjusted for 5,219 clusters in egoID)
      ----------------------------------------------------------------------------------
                       |               Robust
                   tie |      Coef.   Std. Err.      z    P>|z|     Conf. Interval&;
      -----------------+----------------------------------------------------------------
          non_native_A |   .0189835   .0226768     0.84   0.403    -.0254621    .0634292
          non_native_P |  -.0146386   .0170365    -0.86   0.390    -.0480296    .0187524
              female_A |   .1022695   .0179155     5.71   0.000     .0671558    .1373831
              female_P |   .1090134   .0161606     6.75   0.000     .0773392    .1406875
                 age_A |  -.0050619   .0016557    -3.06   0.002    -.0083071   -.0018168
                 age_P |  -.0023033   .0014777    -1.56   0.119    -.0051995     .000593
         yexperience_A |   .0046649   .0020165     2.31   0.021     .0007125    .0086172
         yexperience_P |   .0044483   .0015694     2.83   0.005     .0013724    .0075242
              abroad_A |   -.128605   .0290935    -4.42   0.000    -.1856273   -.0715828
              abroad_P |  -.1157268   .0206689    -5.60   0.000    -.1562372   -.0752164
             postdoc_A |  -.0221316   .0131001    -1.69   0.091    -.0478074    .0035442
             postdoc_P |  -.0118991   .0051629    -2.30   0.021    -.0220181   -.0017801
                 phd_A |    .016206   .0057993     2.79   0.005     .0048395    .0275725
                 phd_P |    .017839   .0028972     6.16   0.000     .0121606    .0235173
              master_A |   .0271436   .0033517     8.10   0.000     .0205745    .0337128
              master_P |   .0279714   .0026199    10.68   0.000     .0228366    .0331063
              underg_A |   .0132841   .0024281     5.47   0.000     .0085251    .0180431
              underg_P |   .0045012   .0018682     2.41   0.016     .0008396    .0081628
            n_papers_A |   .0000782   .0012269     0.06   0.949    -.0023265     .002483
            n_papers_P |  -.0023297   .0005437    -4.29   0.000    -.0033953   -.0012642
              nbooks_A |    .007442   .0046997     1.58   0.113    -.0017693    .0166532
              nbooks_P |   .0060863   .0040286     1.51   0.131    -.0018096    .0139822
      n_book_chapter~A |   .0070884   .0027206     2.61   0.009     .0017561    .0124208
      n_book_chapter~P |   .0050076   .0008863     5.65   0.000     .0032704    .0067448
       n_conf_papers_A |   .0088368   .0019832     4.46   0.000     .0049499    .0127238
       n_conf_papers_P |     .00817   .0008439     9.68   0.000     .0065159    .0098241
                       |
             field_n_A |
      Engineering a..  |  -.4452967   .0543665    -8.19   0.000    -.5518531   -.3387403
           Humanities  |  -1.505276   .0716154   -21.02   0.000     -1.64564   -1.364912
      Interdiscipli~y  |  -.3080232   .0642311    -4.80   0.000    -.4339139   -.1821325
      Medical and H..  |  -.7555083   .0455783   -16.58   0.000    -.8448402   -.6661764
      Natural scien..  |  -.6268278   .0510147   -12.29   0.000    -.7268148   -.5268409
      Social sciences  |   -1.14036   .0550679   -20.71   0.000    -1.248291   -1.032429
                       |
             field_n_P |
      Engineering a..  |  -.5409261   .0543586    -9.95   0.000     -.647467   -.4343851
           Humanities  |  -1.606456   .0692081   -23.21   0.000    -1.742102   -1.470811
      Interdiscipli~y  |  -.4724501   .0612241    -7.72   0.000    -.5924471   -.3524531
      Medical and H..  |  -.8758985   .0509256   -17.20   0.000    -.9757109   -.7760862
      Natural scien..  |  -.6767203   .0544921   -12.42   0.000    -.7835228   -.5699178
      Social sciences  |  -1.218118   .0538069   -22.64   0.000    -1.323578   -1.112659
                       |
              degree_A |   .0781935   .0028297    27.63   0.000     .0726474    .0837396
              degree_P |    .068622   .0011673    58.78   0.000      .066334    .0709099
           same_origin |   .1960827   .0149125    13.15   0.000     .1668547    .2253107
            same_field |   2.511701   .0285172    88.08   0.000     2.455809    2.567594
           same_gender |   .2941759   .0161754    18.19   0.000     .2624728    .3258791
                       |
                ygroup |
            2004-2007  |   .0943496   .0200043     4.72   0.000     .0551419    .1335574
            2008-2011  |   .0104374   .0233935     0.45   0.655    -.0354131    .0562879
            2012-2015  |  -.0909126   .0263474    -3.45   0.001    -.1425526   -.0392726
            2016-2019  |  -.0257161   .0292269    -0.88   0.379    -.0829998    .0315676
                       |
                 _cons |  -5.801146   .0923895   -62.79   0.000    -5.982226   -5.620066
      -----------------+----------------------------------------------------------------
      egoID            |
             var(_cons)|    .222882   .0131549                      .1985344    .2502156
      ----------------------------------------------------------------------------------
      
      .
      . estat icc
      
      Residual intraclass correlation
      
      ------------------------------------------------------------------------------
                             Level |        ICC   Std. Err.     Conf. Interval&;
      -----------------------------+------------------------------------------------
                             egoID |   .0634494   .0035073      .0569127    .0706807
      ------------------------------------------------------------------------------
      Last edited by Luis Grochocki; 22 Jul 2020, 10:45.

      Comment

      Working...
      X