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): http://pajek.imfm.si/doku.php?id=download 

Book: http://vlado.fmf.uni-lj.si/pub/networks/book/

b)      UCINET: http://www.analytictech.com/

c)      The R statistical Package: http://www.r-project.org/

a.       The STATNET library: http://csde.washington.edu/statnet/

b.      A group of R network tutorial files:

http://sna.stanford.edu/rlabs.php

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

a.       SPAN, suite of sas routines for analyzing nets: https://people.duke.edu/~jmoody77/span/span.zip

 

Data files

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

a.       small3.net (Pajek format)

b.      small3mat.txt (raw adj matrix)

2.      HS2: A portion of a small school dataset

a.       Hs.net – (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.       Prison.net (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.      netcreate.sas.  Program to clean the data and write pajek files

                                                              i.      Sdatcln.xpt  resulting cleaned data

                                                            ii.      Adj_allnoms.net  A PAJEK file with all nominations

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

                                                          iii.      Adjis.net  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: nodestats1.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.      paj_nodestatread.sas  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.      nodestats1.sas  A program that calculates measures of interest

1.      uses Sdatcln.xpt 

b.      Peer Influence Models

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

1.      Resulting files:

1.      amat_qap.net 

2.      samesex_qap.net

3.      samegrade_qap.net

4.      samerace_qap.net

5.      timedif_qap.net

6.      trydif_qap.net

7.      fightdif_qap.net

8.      symnet_qap.net

9.      fight.txt

10.  white.txt

11.  tryhard.txt

                                                            ii.      Peer Influence Models (Network Autocorrelation models)

1.      SAS “QAD” version:  peerinf1.sas

2.      R full ML method

1.      Write data from SAS to R: sas2r_peerinfl.sas

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: dist_clust1.sas

1.      Resulting partition: distclust.clu

                                                            ii.      PAJEK Files for use w. UCINET FACTIONS

1.      Adjis.net

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

 

                                                          iii.      Moody “Jiggle” routine

1.      SAS Macros/Modules: Jigfiles.zip

2.      SAS program to run on School data: jiggle_examp1.sas

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: crowd_examp.sas

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: kconfiles.zip

2.      Program to run on school data:

 

c.       Statistical Models for Networks

                                                              i.      Check out tutorials:

1.      STATNET Main page: http://csde.washington.edu/statnet/

2.      STATNET Tutorials: http://csde.washington.edu/statnet/resources.shtml

                                                            ii.      Getting data from SAS to R: statnet_datawrite.sas

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