Only for honest business writer

#### ScriptForReadingInData.R ############################################################################### ################################ -- 1 -- ###################################### ### AddHealth--ADOLESCENT HEALTH NETWORKS ## http://moreno.ss.uci.edu/data.html#adhealth AddHealtcomm1 <- read.table('comm1.txt') ADJ <- matrix(0,71,71) for (i in c(1:dim(AddHealtcomm1)[1]) ){ ADJ[AddHealtcomm1[i,1],AddHealtcomm1[i,2]] <- AddHealtcomm1[i,3] } ADJ[ADJ>0] <- 1 # COLUMN LABELS:

# "sex" # "race" # "grade" AddHealtcomm1Attrib <- read.table('comm1attribs.txt') names(AddHealtcomm1Attrib) <- c('id','var','val') Attribs <- reshape(AddHealtcomm1Attrib,idvar='id',direction='wide',timevar='var') names(Attribs ) <- c('id','sex','race','grade') ############################################################################## ################################ -- 2 -- ###################################### ### Agneessen Trust Network # A subsample of the data used in # Agneessens, F., Koskinen, J. (2016). Modelling individual outcomes using a multilevel social influence (MSI) model, pp. 81-105 in Lazega and Snijders (eds.) Multilevel Network Analysis for the Social Sciences: Theory, Methods and Applications. London: Springer Verlag, # load('orgTrustMat.RData') # the network is 'SmallAdj' # some attributes can be loaded using load('orgVars.RData') # where 'nodevars' is a 60 times 3 matrix with GENDER, AGE, and SAT (work Satisfaction) ############################################################################### ################################ -- 3 -- ###################################### # Coleman, Katz, and Menzel innovation # http://moreno.ss.uci.edu/data.html#ckm # Three 246×246 matrices:

# ADVICE non-symmetric, binary.

# DISCUSSION non-symmetric, binary.

# FRIEND non-symmetric, binary.

CoKaMe <- read.table('colemankatzmentzel.txt') CoKaMeAdvice <- as.matrix(CoKaMe[1:246,]) CoKaMeDisc <- as.matrix(CoKaMe[247:492,]) CoKaMeFriend <- as.matrix(CoKaMe[493:738,]) # You can load attributes:

CoKaMeAttributes <- read.table('Attributescolemankatzmentzel.txt') # descriptions are given at http://moreno.ss.uci.edu/data.html#ckm # for example, the cities # City: 1 Peoria, 2 Bloomington, 3 Quincy, 4 Galesburg # are in column one:

CoKaMeAttributes[,1] ################################################################################ ################################ -- 4 -- ###################################### #### Hollway fisheries ### ## This is a subset of the bilateral treatise data used in Hollway and Koskinen (2016). Multilevel Embeddedness: The Case of the Global Fisheries Governance Complex, Social Networks. 44: 281-294.

## The network has ties between two states if the states have signed a bilateral fisheries agreeement HollFesh <- read.table('HollwayNet.txt') # attribues (also defined in the article) are # 1. log of state GDP # 2. log of number of protected species # 3. log of number of tons of fish taken # 4. number of multilateral treatise signed up to HollAtt <- read.table('HollwayAtt.txt') # the ISO codes for state name is in rownames(HollAtt) # e.g. "SWE" stands for Sweden ################################################################################ ################################ -- 5 -- ###################################### #### Kapferer tailors #### https://www.stats.ox.ac.uk/~snijders/siena/kapfdata.htm temp <- as.matrix(read.table('kapfts1.dat')) # symmetric, binary network of 39 tailors kapfAtt <- read.table("kapfat.dat") # kapfat.dat first variable is a dummy for Lyashi (the most central individual); # second variable indicates workers in high status jobs.

# let's call the status 'status' status <- kapfAtt[,2] kap <- as.network(temp,directed=FALSE) kap %v% 'status' <- status plot(kap,vertex.col='status') sum(adj[status==1,status==1]) sum(adj[status==1,status==0]) sum(adj[status==0,status==0]) ergm(kap ) m1 <- ergm(kap ~ edges+nodecov("status")) m2 <- ergm(kap ~ edges+nodecov("status")+match("status")) m3 <- ergm(kap ~ edges+nodecov("status")+match("status") +gwesp(0.693, fixed=TRUE)) gof(m3) ################################################################################ ################################ -- 6 -- ###################################### ### Lazega Lawfirm # http://moreno.ss.uci.edu/data.html#lazega Laznet <- read.table('LazegaNet.txt') # LAZEGA: Three 71×71 matrices:

# ADVICE non-symmetric, binary.

# FRIENDSHIP non-symmetric, binary.

# CO-WORK non-symmetric, binary.

Advice <- Laznet[1:71,] Friend <- Laznet[72:142,] Cowork <- Laznet[143:213,]# NOTE: desciption is wrong - this is symmetric ## Attributes:

# 1. status (1=partner; 2=associate) # 2. gender (1=man; 2=woman) # 3. office (1=Boston; 2=Hartford; 3=Providence) # 4. years with the firm # 5. age # 6. practice (1=litigation; 2=corporate) # 7. law school (1: harvard, yale; 2: ucon; 3: other) Lazatts <- read.table('Lazatt.txt') Prac <- Lazatts[,7] Prac <- Prac-1 #recode from 1/2 to 0/1 ################################################################################ ################################ -- 7 -- ###################################### #### Marijtje van Duijn Student data ### http://www.stats.ox.ac.uk/~snijders/siena/vDuijn_data.htm temp <- as.matrix(read.table('t5.dat')) # 9 indicates non-reponse # anyone who has 9 times n-1=38 did not answer any questions repondents <- rowSums(temp)<342 # extract the ties of respondents temp <- temp[repondents,repondents] marijte2 <- matrix(0,dim(temp)[1],dim(temp)[2]) # then you can set all ties that are, e.g. 1 or 2 marijte2[temp %in% c(1,2)] <- 1 Attributes <- read.table('cov4.dat') # remove the non-repondents Attributes <- Attributes[repondents,] # Check the website for a description of the 20 variables ################################################################################ ################################ -- 8 -- ###################################### ### Noordin Top Terrorist network ## Everton collated data from the International Crisis Group report # Cunningham D, Everton SF and Murphy PJ (2015) Casting more light on dark networks: A stochastic actor-oriented longitudinal analysis of the Noordin top terrorist network. In: Gerdes LM (ed.) Illuminating Dark Networks: The Study of Clandestine Groups and Organisations. New York: Cambridge University Press, pp. 171–185.

# data description is available from # https://sites.google.com/site/sfeverton18/research/appendix-1 FriendNet <- read.csv('friendship.csv',sep=',',header=TRUE,row.names=1,stringsAsFactors=FALSE) # some of the attributes are listed in NoordinAtts <- read.csv('noordinAttrib.csv',sep=',',header=TRUE,row.names=1,stringsAsFactors=FALSE) # where "Number.ops" is the number of operations an individual took part in # and "Number.meets" is the number of planning meetings an individual took part in ################################################################################ ################################ -- 9 -- ###################################### ##### Sageman Al Qaeda # Described in e.g. https://pdfs.semanticscholar.org/9969/867c4feeae90e40b10f4e5dde0067868f84c.pdf # and # Sageman, Marc. 2004. Understanding Terror Networks. University of Pennsylvania Press.

# The ties are undirected and there are 368 nodes:

SagemanAdjacencyMatrix <- read.table('sagemanAdjacency368.txt') # there are a lot of attributes SageAttributes <- read.csv('sageAttributes.csv',stringsAsFactors=FALSE) # the variable names are given by names(SageAttributes) ############################################################################### ################################ -- 10 -- ###################################### ### Stockholm Birth Cohort ### Three schools from the data set analysed in ### Koskinen, J. & Stenberg, S. Å. Apr 2012 In : Journal of Educational and Behavioral Statistics. 37:203-230.

### Ties are 'who is your best friend' (number of best friends limited to at most 3) BestF405 <- read.table('schoolBFNet405.txt') BestF379 <- read.table('schoolBFNet379.txt') BestF604 <- read.table('schoolBFNet604.txt') ### there are 13 covariates:

# 1. intend to apply to higher secondary education (yes=1, no/don't know =0, missing=99) # 2. 'Sex' (male=0, fem=1) # 3. 'Welfare' # 4.'Parent psych' # 5.'Social class 1' # 6. 'Social class 2' # 7. 'Social class 3' # 8. 'Social class 4' # 9. 'Family attitude' # 10. 'Safe in School' # 11. 'interest in school' # 12. 'test score on verb, spat & num test' # 13. 'Marks' Covs405 <- read.table('schoolCovars405.txt') Covs379 <- read.table('schoolCovars379.txt') Covs604 <- read.table('schoolCovars604.txt') ############################################################################### ################################ -- 11 -- ###################################### #### WEBSTER--ACCOUNTING FIRM ##### http://moreno.ss.uci.edu/data.html#acct # A symmetrised version of Webster <- read.table('Webster.txt') ADJ <-Webster[c((2*24+1):(3*24)),] ADJ[ADJ>0] <-1 WebsterAtt <- read.table('WebsterAtt.txt') ############################################################################# ################################ -- 12 -- ###################################### ### Zeggelink ## http://www.stats.ox.ac.uk/~snijders/siena/Zeggelink_data.htm # stu98t0 looks a little strange so I only show t2 # you can read in the text file as usual temp <- as.matrix(read.table('stu98t2.txt')) # i call it temp because i want to recode # and this is easier # first create an empty adjacency matrix zeglinkt2 <- matrix(0,dim(temp)[1],dim(temp)[2]) # then you can set all ties that are, e.g. 1,2, or 3 zeglinkt2[temp %in% c(1,2,3)] <- 1 # this is both a logical and not so logical command:

# it is logical because it returns 'TRUE' if the value of temp # is one of 1, 2 , or 3 # it is illogical because zeglinkt2 is a matrix # and we only use one argument in '[ ]' # done!

Attributes <- read.table('stud98.txt') # Id number # Gender: 1= male; 2=female # Age in years # Program: 1= regular 4-year program; 2=2-year program # Smoking: 1=no; 2=yes, at parties (social); 3=1-3 cigarettes per day, 4=4-10 p.d.; 5= more than 10 p.d., 99 = missing.