Announcement

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

  • Creating a new matrix on social network

    Dear all

    I have row data on social networks like

    person ID neighbor ID Did you know him? (yes =1)
    1 1 0
    1 2 1
    1 3 0
    2 1 1
    2 2 0
    2 3 1
    3 1 0
    3 2 1
    3 3 0

    I would like to know STATA commend to make this data into a 3 by 3 matrix like

    1 2 3

    1 0 1 0
    2 1 0 1
    3 0 2 0

    Can anybody give me some advice on this?
    Please also refer to excel sheet attached.
    Thank you very much.

    Yuko
    Attached Files
    Last edited by Yuko Nakano; 11 Mar 2020, 21:34.

  • #2
    There is a whole suite of social network commands here:

    https://nwcommands.wordpress.com/

    Before you start reinventing the wheel, take a look at that.

    As to your question: the best way really depends on what exactly you want to do with the result. For example, if you just want to look at the adjacency matrix, then I would do nothing to the data, but instead use tabdisp. If you want to do computations, then you have to decide if you want your matrix as a Stata dataset, Stata matrix, or Mata matrix.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Dear Maarten

      Thank you very much!
      In fact, I was trying to use nwcommands and got stuck because I could not understand
      how to make my data suitable for using the commands.
      I will try tabdisp also.

      Comment

      Working...
      X