In this assignment, you will be working with two-mode network described in your assigned reading, Borgatti, S. and Halgin, D. (2011). Analyzing Affiliation Networks . In John P. Scott and Peter J. Carrington (Ed.), The SAGE Handbook of Social Network Analysis. Sage Publications Ltd. Perform the following steps: 1. Code the women and event data as a two-mode network in a CSV file. This step has already been done for you and the CSV file is available here for download. 2. Load this data set as a matrix and show that it has been loaded properly. You may do so by displaying the contents of the loaded matrix.
library(tinytex)
library(formatR)
data = read.csv("Lesson3assignment.csv", header = TRUE, row.name = 1)
data <- as.matrix(data)
data
## M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 M12 M13 M14 M15
## EVELYN 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0
## LAURA 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0
## THERESA 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0
## BRENDA 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0
## CHARLOTTE 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0
## FRANCES 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0
## ELEANOR 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0
## PEARL 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0
## RUTH 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0
## VERNE 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0
## MYRNA 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0
## KATHERINE 0 0 0 0 0 0 0 1 1 1 0 1 1 0 0
## SYLVIA 0 0 0 0 0 0 1 1 1 1 0 1 1 0 0
## NORA 0 0 0 0 0 1 1 0 1 1 1 1 1 0 0
## HELEN 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0
## DOROTHY 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
## OLIVIA 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
## FLORA 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
Using the network package to view the network attributes:
library(network)
## network: Classes for Relational Data
## Version 1.13.0.1 created on 2015-08-31.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
## Mark S. Handcock, University of California -- Los Angeles
## David R. Hunter, Penn State University
## Martina Morris, University of Washington
## Skye Bender-deMoll, University of Washington
## For citation information, type citation("network").
## Type help("network-package") to get started.
data1 <- network(data, directed = F)
data1
## Network attributes:
## vertices = 33
## directed = FALSE
## hyper = FALSE
## loops = FALSE
## multiple = FALSE
## bipartite = 18
## total edges= 72
## missing edges= 0
## non-missing edges= 72
##
## Vertex attribute names:
## vertex.names
##
## No edge attributes
summary(data1)
## Network attributes:
## vertices = 33
## directed = FALSE
## hyper = FALSE
## loops = FALSE
## multiple = FALSE
## bipartite = 18
## total edges = 72
## missing edges = 0
## non-missing edges = 72
## density = 0.1363636
##
## Vertex attributes:
## vertex.names:
## character valued attribute
## 33 valid vertex names
##
## No edge attributes
##
## Network edgelist matrix:
## [,1] [,2]
## [1,] 19 1
## [2,] 20 1
## [3,] 21 1
## [4,] 22 1
## [5,] 23 1
## [6,] 24 1
## [7,] 26 1
## [8,] 19 2
## [9,] 20 2
## [10,] 21 2
## [11,] 22 2
## [12,] 23 2
## [13,] 24 2
## [14,] 25 2
## [15,] 20 3
## [16,] 21 3
## [17,] 22 3
## [18,] 23 3
## [19,] 24 3
## [20,] 25 3
## [21,] 26 3
## [22,] 19 4
## [23,] 21 4
## [24,] 22 4
## [25,] 23 4
## [26,] 24 4
## [27,] 25 4
## [28,] 21 5
## [29,] 22 5
## [30,] 23 5
## [31,] 21 6
## [32,] 23 6
## [33,] 24 6
## [34,] 23 7
## [35,] 24 7
## [36,] 25 7
## [37,] 24 8
## [38,] 26 8
## [39,] 23 9
## [40,] 25 9
## [41,] 26 9
## [42,] 25 10
## [43,] 26 10
## [44,] 27 10
## [45,] 26 11
## [46,] 27 11
## [47,] 28 11
## [48,] 26 12
## [49,] 27 12
## [50,] 28 12
## [51,] 30 12
## [52,] 31 12
## [53,] 25 13
## [54,] 26 13
## [55,] 27 13
## [56,] 28 13
## [57,] 30 13
## [58,] 31 13
## [59,] 24 14
## [60,] 25 14
## [61,] 27 14
## [62,] 28 14
## [63,] 29 14
## [64,] 30 14
## [65,] 31 14
## [66,] 25 15
## [67,] 26 15
## [68,] 28 15
## [69,] 29 15
## [70,] 26 16
## [71,] 27 17
## [72,] 27 18
library(sna)
## Loading required package: statnet.common
##
## Attaching package: 'statnet.common'
## The following object is masked from 'package:base':
##
## order
## sna: Tools for Social Network Analysis
## Version 2.4 created on 2016-07-23.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
## For citation information, type citation("sna").
## Type help(package="sna") to get started.
m <- matrix(data = "light blue", nrow = 18)
n <- matrix(data = "brown1", ncol = 15)
color <- c(m, n)
gplot(data1, gmode = "twomode", displayisolates = T, displaylabels = T,
label.col = color, label.cex = 0.8, usearrows = FALSE, edge.col = "grey")
4. Convert the two-mode network matrix into one-mode network matrix
connections.female <- data %*% t(data)
connections.female
## EVELYN LAURA THERESA BRENDA CHARLOTTE FRANCES ELEANOR PEARL RUTH
## EVELYN 7 6 6 5 3 3 2 2 2
## LAURA 6 7 6 6 3 3 3 1 2
## THERESA 6 6 7 5 3 3 3 2 3
## BRENDA 5 6 5 6 3 3 3 1 2
## CHARLOTTE 3 3 3 3 3 2 1 0 1
## FRANCES 3 3 3 3 2 3 2 1 1
## ELEANOR 2 3 3 3 1 2 3 1 2
## PEARL 2 1 2 1 0 1 1 2 1
## RUTH 2 2 3 2 1 1 2 1 3
## VERNE 1 1 2 1 0 0 1 1 2
## MYRNA 1 0 1 0 0 0 0 1 1
## KATHERINE 1 0 1 0 0 0 0 1 1
## SYLVIA 1 1 2 1 0 0 1 1 2
## NORA 1 2 2 2 0 1 2 1 1
## HELEN 1 1 2 1 0 0 1 1 2
## DOROTHY 1 0 1 0 0 0 0 1 1
## OLIVIA 0 0 0 0 0 0 0 0 0
## FLORA 0 0 0 0 0 0 0 0 0
## VERNE MYRNA KATHERINE SYLVIA NORA HELEN DOROTHY OLIVIA FLORA
## EVELYN 1 1 1 1 1 1 1 0 0
## LAURA 1 0 0 1 2 1 0 0 0
## THERESA 2 1 1 2 2 2 1 0 0
## BRENDA 1 0 0 1 2 1 0 0 0
## CHARLOTTE 0 0 0 0 0 0 0 0 0
## FRANCES 0 0 0 0 1 0 0 0 0
## ELEANOR 1 0 0 1 2 1 0 0 0
## PEARL 1 1 1 1 1 1 1 0 0
## RUTH 2 1 1 2 1 2 1 0 0
## VERNE 3 2 2 3 2 2 1 1 1
## MYRNA 2 3 3 3 2 2 1 1 1
## KATHERINE 2 3 5 5 4 2 1 1 1
## SYLVIA 3 3 5 6 5 3 1 1 1
## NORA 2 2 4 5 7 3 0 1 1
## HELEN 2 2 2 3 3 4 1 0 0
## DOROTHY 1 1 1 1 0 1 1 0 0
## OLIVIA 1 1 1 1 1 0 0 1 1
## FLORA 1 1 1 1 1 0 0 1 1
B. The other network should show the relationship among the events. Display this matrix.
connections.events <-t(data) %*% data
connections.events
## M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 M12 M13 M14 M15
## M1 3 2 3 3 3 3 2 1 0 0 0 0 0 0 0
## M2 2 3 3 3 3 3 2 2 0 0 0 0 0 0 0
## M3 3 3 6 5 6 5 3 2 0 0 0 0 0 0 0
## M4 3 3 5 5 5 4 3 2 0 0 0 0 0 0 0
## M5 3 3 6 5 8 6 5 3 0 0 0 0 0 0 0
## M6 3 3 5 4 6 8 5 3 1 1 1 1 1 0 0
## M7 2 2 3 3 5 5 9 5 3 3 2 2 2 0 0
## M8 1 2 2 2 3 3 5 10 4 4 1 2 2 0 0
## M9 0 0 0 0 0 1 3 4 7 4 1 3 3 0 0
## M10 0 0 0 0 0 1 3 4 4 5 2 3 3 0 0
## M11 0 0 0 0 0 1 2 1 1 2 2 1 1 0 0
## M12 0 0 0 0 0 1 2 2 3 3 1 3 3 0 0
## M13 0 0 0 0 0 1 2 2 3 3 1 3 3 0 0
## M14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## M15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
A.
gplot(connections.female)
B.
gplot(connections.events)