SSRI Introduction to Networks


Powerpoint Files – Just in case you want copies to follow along.

Part 1 files: snintro_SSRI_2011.ppt


Workshop Data & Analysis files.

As part of the 2nd part, we will run through a set of example analyses to get a feeling for how to do analyses.  You can follow along as you want.


Analysis programs

a)      PAJEK (v2.03 is most recent): 


b)      UCINET:

c)      The R statistical Package:

a.       The STATNET library:

b.      A group of R network tutorial files:

d)      SAS (not free: you must have this from your administrator)

a.       SPAN, suite of sas routines for analyzing nets:


Data files

1.      small3: A small made-up example for display

a. (Pajek format)

b.      small3mat.txt (raw adj matrix)

2.      HS2: A portion of a small school dataset

a. – (pajek format)

b.      Hs_grade.clu (pajek format) Grade level for HS

c.       Hs_sex.clu (pajek format) Sex variable for HS

3.      Gangon Prison data

a. (pajek format)


For realism, we may also work through analyzing data from a “school” network – the data file is fake; but made up in a way that closely resembles a real-world network.  All of the files are derived from the first, though I put the results here just for those who don’t have SAS but do have the other routines.  I write everything w. transport files, just to make moving on the web and such simpler.


1)      Creating network data from a Survey.

a.       schldat.xpt  SAS transport file w. base nomination data.

b.  Program to clean the data and write pajek files

                                                              i.      Sdatcln.xpt  resulting cleaned data

                                                            ii.  A PAJEK file with all nominations

1.      adjallnoms_ischl.clu  1=in-school node, 0 = out of sample.

                                                          iii.  A PAJEK file w. just ‘in school’ nominations

                                                          iv.      A set of partitions for attributes:

1.      adjis_female.clu  1 = female, 0=male

2.      adjis_fights.clu   number of fights in last year

3.      adjis_grade.clu   year in school

4.      adjis_white.clu   1=white, 0 = non-white

2)      Some basic descriptive stats in SAS:

3)      Running R from a PAJEK export file: Pajek2r1.r


4)      Peer Influence & Network Behavior Models

a.       Network Structure Models.  Here we use some simple measures on nets to model a behavior outcomes.

                                                              i.      Using files from PAJEK

1.  A file that reads .CLU & .VEC files output by PAJEK into SAS

1.      The PAJEK Files we created

1.      adjis_closeness.vec

2.      adjis_indeg.clu

3.      adjis_outdeg.clu

4.      adjis_totdeg.clu

                                                            ii.      Calculating network structure models in SAS

1.  A program that calculates measures of interest

1.      uses Sdatcln.xpt 

b.      Peer Influence Models

                                                              i.      QAP Models.  moves data from SAS to .NET files that UCINET can read

1.      Resulting files:









9.      fight.txt

10.  white.txt

11.  tryhard.txt

                                                            ii.      Peer Influence Models (Network Autocorrelation models)

1.      SAS “QAD” version:

2.      R full ML method

1.      Write data from SAS to R:

1.      send2r.mac macro for moving data from SAS to R

2.      Resulting files:

1.      edgepi.xpt  (Network edge file)

2.      dycovpi.xpt (network dyad covariate file)

3.      nodespi.xpt (node covariate file)

2.      R scripts

1.      reading the network data: sas2r_lnam.r

2.      running LNAMs: lnam_example.r

5)      Network Structure Models

a.       Clustering Networks

                                                              i.      Simple clustering of distance matrix:

1.      Resulting partition: distclust.clu

                                                            ii.      PAJEK Files for use w. UCINET FACTIONS


2.      PAJEK Blocking – Build a MDL file (6 group sol)


                                                          iii.      Moody “Jiggle” routine

1.      SAS Macros/Modules:

2.      SAS program to run on School data:

1.      school largest component edge list: adjis_lcelist.txt

2.      School x, y & z cords: adjis_lcx.vec, adjis_lcy.vec, adjis_lcz.vec

3.      CROWDS Example (not going to run this time..)

1.      SAS file for running the model:

1.      An example output file: crowd_examp.clu (255 node net)

b.      Blocking Networks

                                                              i.      Classic CONCOR

1.      Easy to run  in UCINET –

1.      Output for a 3-depth sol: ucinet_cc1.clu, ucinet_cc2.clu, ucinet_cc3.clu

                                                            ii.      Positional Models

1.      Core-periphery models

1.      White only subnetwork:

2.      output from UCINET model:

2.      Regular equivalence models

1.      UCINET

2.      Triad-structure

                                                          iii.      Moody/White Cohesive-Blocking

1.      Files needed to add to SPAN:

2.      Program to run on school data:


c.       Statistical Models for Networks

                                                              i.      Check out tutorials:

1.      STATNET Main page:

2.      STATNET Tutorials:

                                                            ii.      Getting data from SAS to R:

1.      Resulting files:

1.      s_edge.xpt

2.      s_dycov.xpt

3.      s_nodes.xpt

4.      sas2statnet1.r (script for reading data)

                                                          iii.      Running some ERGM models

1.      statnet_models.r (script for running example ERGMs)

2.      Saved workspace, since many of the models take too long to run: ergm_exams.RData