For the final project, I will once again visit the work of Alan Daly and colleagues as I attempt to replicate some of the analyses described in Chapter 9: Network Data and Statistical Models from Social Network Analysis and Education (Carolan 2014). In this case study, I will move beyond the visual and mathematical descriptions of networks explored so far to uncover generative processes, or mechanisms, that attempt to explain how school leaders select peers for collaboration or confidential exchanges.
More specifically, this case study will cover the following topics pertaining to each data-intensive workflow process:
Prepare: Prior to analysis, we’ll take a look at the context from which our data came, and share the research question that will guide this analysis.
Wrangle: In section 2 we will transform the data so that there will be distinct datasets based on gender. The research process from unit 4 will be replicated for the new data set and will be used for comparative analysis.
Analyze: In section 3, we will incorporate ERGMs to compare this model to our previous ERGM.
Communicate: Finally, we’ll select, polish, and narrate a key finding from our analysis that helps to answer or research question(s).
Unit 4 explored the influence of gender, location, and trust as predictors of confidential interactions between school leaders. I chose to expand on this analysis to specifically investigate female to male interactions. My research question is as follows:
Are female school leaders more likely to confide in colleagues of their own gender than their male counterparts?
This analysis utilizes the School Leaders data mentioned above. In Chapter 9, Carolan (2014) describes this data by saying:
“These ideas and tools will be demonstrated using a portion of the School Leaders data set, particularly observations in years 1 and 3 of the”collaboration” and “confidential help” networks. Collaboration is a directed valued network measured on five-point scale ranging from 0 to 4, with higher values indicating more frequent collaborations (1–2 times/week). Similarly, the confidential help network is a directed, valued network measured on the same scale. Complete network data are available on all 43 school leaders drawn from two large school districts. In addition to these relational data, the survey instrument in year 1 captured attribute data, including composite scores from a set of items related to efficacy (19 items) and trust (8 items), as well as information about leaders’ gender and whether they worked at the district or school level”.
1c. Target Audience
As a board-certified music therapist and a doctoral candidate in educational psychology, I am interested in the psychological processes within educational context. As it relates to school leaders, I think that this data analysis will be beneficial for industrial/organizational psychologist whose clinical focus is workplace behaviors.
library(knitr)
library(tidyverse)
library(janitor)
library(skimr)
library(ggraph)
library(igraph)
library(tidygraph)
library(readxl)
library(network)
library(kableExtra)
library(texreg)
library(ergm)
library(statnet.common)
For our data wrangling this week, we’ll focus on working with network data stored as an adjacency matrix. Our primary goals are:
Data preprocessing. In this section, we will replicate the steps from the Unit 4 case study.
Data transformations. Finally, we’ll mutate our matrix to include only female school leaders that will then be used to convert to an edge-list and store both our edges and node attributes as a network igraph object in preparation for analysis.
New variables or features. Once preprocessing is completed, we will follow the steps to move from a valued matrix to a binary matrix.
One of our primary goals is to replicate the ERGM analysis from Chapter 9: Network Data and Statistical Models (Carolan 2014). Specifically, we’ll aim to reproduce the results from Table 9.4. Results of P1 and P*Analyses for the Dichotomized and Directed School Leaders Confidential Exchanges Network Year 3.
To do so, we’ll need to import two Excel files from the Social Network Analysis and Education companion site. The first file contains our edges stored as a square matrix (more on this later) and the second file is a standard rectangular data frame that contains attributes for each node, i.e. school leaders. These files are included in the data folder of your R Studio project. A description of each file from the companion website is linked above and each data file is linked below:
School Leaders Data Chapter 9_d. This adjacency matrix reports on “confidential help” ties among 43 school leaders in year 3 of a three-year study. This is a directed valued (weighted) network measured on five-point scale ranging from 0 to 4, with higher values indicating more frequent collaborations (1–2 times/week). These data are used throughout Chapter 9.
School Leaders Data Chapter 9_e. This rectangular matrix consists of four attribute vectors for 43 school leaders. Following the first ID column, the matrix includes an efficacy score, trust score, and indicators for whether one works at the district-level and is male (1 = yes, 0 = no). These attribute variables will be used as covariates in our ERGMs later in this walkthrough.
Since we are working with Excel files, we’ll need to use the
read_excel() function from {readxl} tidyverse package to
import our data. Let’s import the
School Leaders Data Chapter 9_e.xlsx node file located in
the data/ folder first:
leader_nodes <- read_excel("data/School Leaders Data Chapter 9_e.xlsx",
col_types = c("text", "numeric", "numeric", "numeric", "numeric")) |>
clean_names()
leader_nodes
## # A tibble: 43 × 5
## id efficacy trust district_site male
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 6.06 4 1 0
## 2 2 6.56 5.63 1 0
## 3 3 7.39 4.63 1 0
## 4 4 4.89 4 1 0
## 5 5 6.06 5.75 0 1
## 6 6 7.39 4.38 0 0
## 7 7 5.56 3.63 0 1
## 8 8 7.5 5.63 1 1
## 9 9 7.67 5.25 0 0
## 10 10 6.64 4.78 0 0
## # … with 33 more rows
leader_matrix <- read_excel("data/School Leaders Data Chapter 9_d.xlsx",
col_names = FALSE)
Note that we specified the ID column as “text” and the
remaining columns as “numeric.” By default, the readxl()
function would have recognized each column as numeric, but the first
column indicates the “names” for each school leader and we’ll be using
this column to assign names to our columns and rows for our adjacency
matrix in just a bit.
Recall from above that our relations, or edges, are stored as a valued adjacency matrix in which columns and rows consist of the same actors and each cell contains information about the tie between each pair of actors. In our case, the tie is a directed and valued “arc” where the value indicates the strength of the relationship.
Use the read_excel() function to import the
School Leaders Data Chapter 9_d.xlsx file, add an argument
setting the column names to FALSE since our file is a
simple matrix with no header or column names, and assign the matrix to a
variable named leader_matrix:
leader_matrix <- read_excel("data/School Leaders Data Chapter 9_d.xlsx",
col_names = FALSE)
I will use the code chunk below to inspect the matrix I just imported:
leader_matrix
## # A tibble: 43 × 43
## ...1 ...2 ...3 ...4 ...5 ...6 ...7 ...8 ...9 ...10 ...11 ...12 ...13
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0
## 2 0 0 0 0 0 0 0 0 0 0 0 0 0
## 3 3 1 0 1 1 1 1 2 1 1 1 1 1
## 4 1 0 0 0 0 0 0 0 0 0 0 0 0
## 5 0 0 0 0 0 0 1 0 3 0 0 0 0
## 6 0 0 0 0 0 0 0 0 0 0 0 0 0
## 7 2 1 1 1 1 1 4 1 1 3 1 1 1
## 8 1 1 4 1 1 1 1 0 2 3 1 1 1
## 9 1 0 0 0 4 0 0 1 0 0 0 0 0
## 10 1 1 3 1 1 1 4 4 1 0 3 1 1
## # … with 33 more rows, and 30 more variables: ...14 <dbl>, ...15 <dbl>,
## # ...16 <dbl>, ...17 <dbl>, ...18 <dbl>, ...19 <dbl>, ...20 <dbl>,
## # ...21 <dbl>, ...22 <dbl>, ...23 <dbl>, ...24 <dbl>, ...25 <dbl>,
## # ...26 <dbl>, ...27 <dbl>, ...28 <dbl>, ...29 <dbl>, ...30 <dbl>,
## # ...31 <dbl>, ...32 <dbl>, ...33 <dbl>, ...34 <dbl>, ...35 <dbl>,
## # ...36 <dbl>, ...37 <dbl>, ...38 <dbl>, ...39 <dbl>, ...40 <dbl>,
## # ...41 <dbl>, ...42 <dbl>, ...43 <dbl>
*This step was not included in the Unit 4 Case Study. The output is also not showing up, so please see the console below for the output.
Using the mutate() , case_when() and
select() functions, we’re creating a column for female
values and removing the male values:
female_leader_nodes <- leader_nodes |>
mutate(female = case_when(male >= 1 ~ '0', TRUE ~ '1')) |>
mutate(female = as.double(female)) |>
select(id, efficacy, trust, district_site, female)
female_leader_nodes
## # A tibble: 43 × 5
## id efficacy trust district_site female
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 6.06 4 1 1
## 2 2 6.56 5.63 1 1
## 3 3 7.39 4.63 1 1
## 4 4 4.89 4 1 1
## 5 5 6.06 5.75 0 0
## 6 6 7.39 4.38 0 1
## 7 7 5.56 3.63 0 0
## 8 8 7.5 5.63 1 0
## 9 9 7.67 5.25 0 1
## 10 10 6.64 4.78 0 1
## # … with 33 more rows
Since one of our goals is a crude replication of the analysis demonstrated in Chapter 9, and since working with “valued networks” is a little more complex than binary networks that simply indicate the presence or absence of a tie, we will need to “dichotomize” our matrix. In practice this simply entails converting our valued matrix to a binary matrix with cells containing just 1s or 0s.
In their article, Valued Ties Tell Fewer Lies: Why Not To Dichotomize Network Edges With Thresholds, Thomas and Blitzstein (2018) highlight several reasons why the dichotomization procedure is appealing in an investigation aside from convenience and simplicity:
Use of Exclusively Binary Methods. Several classes of models have been designed to incorporate binary information directly, including the exponential random graph model.
Ease of Input and Data Collection. The need to classify continuously-valued quantities into a set of discrete groups is widespread throughout all of science and technology, particularly because of the associated need to make clear decisions based on this information.
Ease of Output in Graphical Representations. The visual appeal of graphs and networks has contributed to much of the field’s attention in the past decade. When plotting a graphical structure, a clever choice of threshold can illuminate which nodes are most central, which connections the most vital.
Sparsity of Structure. In data where there are very few natural zeroes (if any), di- chotomization provides a way to select for a small number of connections which are thought to be of the greatest importance to the system, or to nominate a number of ties for more in-depth study.
Binning To Address Nonlinearity and Reduce Noise. If there is a nonlinear relationship in the data, binning the data into distinct ordinal categories has many advantages, namely, the reduction of total mean-squared error, and a corresponding increase in power for detecting a true non-zero relationship over an improperly specified linear analysis.
As the title of their article suggests, however, Thomas and Blitzstein (2011) argue that the motivations for dichotomization should be revisited as dichotomization produces a range of problematic issues.
With that in mind, and before we can dichotomize our “matrix,” we
first need to convert it to a matrix object recognized by R using the
as.matrix() function. We can then check to data format of
our leader_matrix using the class()
function:
leader_matrix <- leader_matrix |>
as.matrix()
class(leader_matrix)
## [1] "matrix" "array"
Both the collaboration and confidential help network data were dichotomized by recoding values originally coded as a 3 and 4 recoded to 1, indicating the presence of a directed tie for both relations, and zero otherwise.
To dichotomize our our matrix, the following code will “assign” 0’s to all values in our matrix that are less than or equal to 2, and 1’s to all values that are greater the or equal to 3:
leader_matrix[leader_matrix <= 2] <- 0
leader_matrix[leader_matrix >= 3] <- 1
Before we can convert to an edge-list, we will also need to add the
names of our nodes to the columns and rows of our matrix. These are
stored in the ID column of our leader_node
data frame. We can use the $ operator to select these names
and assign to our leader_matrix using the
rownames() and colnames() functions
respectively:
rownames(leader_matrix) <- leader_nodes$id
colnames(leader_matrix) <- leader_nodes$id
leader_matrix
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
## 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 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1 0 1 1 0 0 0 0 1
## 22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 24 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
## 25 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 26 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 27 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0
## 28 1 0 0 1 0 1 0 1 1 1 0 0 0 0 0
## 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 34 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 36 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
## 37 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
## 38 0 0 0 0 1 1 0 1 1 0 1 0 0 0 1
## 39 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 41 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 42 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
## 43 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0
rownames(leader_matrix) <- female_leader_nodes$id
colnames(leader_matrix) <- female_leader_nodes$id
leader_matrix
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
## 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 3 1 0 0 0 0 0 0 0 0 0 0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 0 0 0
## 19 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
## 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 21 0 0 0 0 1 0 1 0 1 1 0 0 0 0 1
## 22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 24 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
## 25 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 26 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 27 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0
## 28 1 0 0 1 0 1 0 1 1 1 0 0 0 0 0
## 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 34 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 36 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
## 37 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
## 38 0 0 0 0 1 1 0 1 1 0 1 0 0 0 1
## 39 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## 41 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## 42 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
## 43 0 0 0 1 1 1 0 0 1 0 0 0 0 1 0
Recall that edge-lists contain a row for each dyad consisting of at minimum two columns with the name of each actor, and which conveniently can also contain other information or attributes about the relationship such as edge weight, timestamps, or other contextual information as demonstrated in Unit 1.
Edge-lists also have the advantage of being easier to work with when using network packages in R.
First we need to convert our matrix to an igraph network object.
adjacency_matrix <- graph.adjacency(leader_matrix,
diag = FALSE)
class(adjacency_matrix)
## [1] "igraph"
adjacency_matrix
## IGRAPH f79063e DN-- 43 143 --
## + attr: name (v/c)
## + edges from f79063e (vertex names):
## [1] 3 ->1 3 ->27 3 ->28 3 ->36 3 ->38 4 ->16 4 ->28 4 ->34 4 ->36 5 ->9
## [11] 7 ->10 7 ->20 8 ->3 8 ->10 8 ->25 8 ->27 8 ->28 8 ->37 8 ->38 9 ->5
## [21] 9 ->14 10->3 10->7 10->8 10->11 10->18 10->20 10->38 11->10 11->21
## [31] 11->23 11->35 13->8 13->35 13->42 14->37 15->21 15->39 15->42 15->43
## [41] 16->22 17->26 18->29 18->34 19->31 20->7 20->10 21->1 21->11 21->12
## [51] 21->15 21->33 21->35 21->37 21->38 21->43 22->8 22->16 22->28 23->5
## [61] 23->11 24->27 24->42 25->3 25->8 26->17 26->41 27->24 27->32 27->42
## [71] 28->1 28->2 28->3 28->4 28->6 28->8 28->9 28->10 28->13 28->18
## + ... omitted several edges
Now we can use the get.data.frame() function to covert
our matrix to a standard edge-list:
leader_edges <- get.data.frame(adjacency_matrix) |>
mutate(from = as.character(from)) |>
mutate(to = as.character(to))
leader_edges
## from to
## 1 3 1
## 2 3 27
## 3 3 28
## 4 3 36
## 5 3 38
## 6 4 16
## 7 4 28
## 8 4 34
## 9 4 36
## 10 5 9
## 11 7 10
## 12 7 20
## 13 8 3
## 14 8 10
## 15 8 25
## 16 8 27
## 17 8 28
## 18 8 37
## 19 8 38
## 20 9 5
## 21 9 14
## 22 10 3
## 23 10 7
## 24 10 8
## 25 10 11
## 26 10 18
## 27 10 20
## 28 10 38
## 29 11 10
## 30 11 21
## 31 11 23
## 32 11 35
## 33 13 8
## 34 13 35
## 35 13 42
## 36 14 37
## 37 15 21
## 38 15 39
## 39 15 42
## 40 15 43
## 41 16 22
## 42 17 26
## 43 18 29
## 44 18 34
## 45 19 31
## 46 20 7
## 47 20 10
## 48 21 1
## 49 21 11
## 50 21 12
## 51 21 15
## 52 21 33
## 53 21 35
## 54 21 37
## 55 21 38
## 56 21 43
## 57 22 8
## 58 22 16
## 59 22 28
## 60 23 5
## 61 23 11
## 62 24 27
## 63 24 42
## 64 25 3
## 65 25 8
## 66 26 17
## 67 26 41
## 68 27 24
## 69 27 32
## 70 27 42
## 71 28 1
## 72 28 2
## 73 28 3
## 74 28 4
## 75 28 6
## 76 28 8
## 77 28 9
## 78 28 10
## 79 28 13
## 80 28 18
## 81 28 21
## 82 28 22
## 83 28 25
## 84 28 27
## 85 28 29
## 86 28 32
## 87 28 34
## 88 28 36
## 89 28 37
## 90 28 38
## 91 31 19
## 92 32 24
## 93 33 21
## 94 34 18
## 95 34 22
## 96 34 28
## 97 34 29
## 98 35 21
## 99 36 1
## 100 36 3
## 101 36 4
## 102 36 8
## 103 36 16
## 104 36 18
## 105 36 26
## 106 36 27
## 107 36 28
## 108 36 34
## 109 37 3
## 110 37 14
## 111 37 38
## 112 38 1
## 113 38 3
## 114 38 8
## 115 38 11
## 116 38 18
## 117 38 22
## 118 38 26
## 119 38 27
## 120 38 28
## 121 38 33
## 122 38 34
## 123 38 36
## 124 38 37
## 125 38 39
## 126 38 43
## 127 42 9
## 128 42 15
## 129 42 24
## 130 42 27
## 131 42 43
## 132 43 5
## 133 43 8
## 134 43 15
## 135 43 18
## 136 43 21
## 137 43 22
## 138 43 23
## 139 43 32
## 140 43 33
## 141 43 34
## 142 43 37
## 143 43 42
Now we will convert our data frames into a network graph.
leader_graph <- tbl_graph(edges = leader_edges,
nodes = leader_nodes,
directed = TRUE)
leader_graph
## # A tbl_graph: 43 nodes and 143 edges
## #
## # A directed simple graph with 4 components
## #
## # Node Data: 43 × 5 (active)
## id efficacy trust district_site male
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 1 6.06 4 1 0
## 2 2 6.56 5.63 1 0
## 3 3 7.39 4.63 1 0
## 4 4 4.89 4 1 0
## 5 5 6.06 5.75 0 1
## 6 6 7.39 4.38 0 0
## # … with 37 more rows
## #
## # Edge Data: 143 × 2
## from to
## <int> <int>
## 1 3 1
## 2 3 27
## 3 3 28
## # … with 140 more rows
Using the mutate() function, we’ll calculate degree:
leader_measures <- leader_graph |>
activate(nodes) |>
mutate(in_degree = centrality_degree(mode = "in")) |>
mutate(out_degree = centrality_degree(mode = "out")) |>
mutate(degree = centrality_degree(mode = "total"))
leader_measures
## # A tbl_graph: 43 nodes and 143 edges
## #
## # A directed simple graph with 4 components
## #
## # Node Data: 43 × 8 (active)
## id efficacy trust district_site male in_degree out_degree degree
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 6.06 4 1 0 5 0 5
## 2 2 6.56 5.63 1 0 1 0 1
## 3 3 7.39 4.63 1 0 7 5 12
## 4 4 4.89 4 1 0 2 4 6
## 5 5 6.06 5.75 0 1 3 1 4
## 6 6 7.39 4.38 0 0 1 0 1
## # … with 37 more rows
## #
## # Edge Data: 143 × 2
## from to
## <int> <int>
## 1 3 1
## 2 3 27
## 3 3 28
## # … with 140 more rows
node_measures <- leader_measures |>
activate(nodes) |>
as_tibble()
node_measures
## # A tibble: 43 × 8
## id efficacy trust district_site male in_degree out_degree degree
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 6.06 4 1 0 5 0 5
## 2 2 6.56 5.63 1 0 1 0 1
## 3 3 7.39 4.63 1 0 7 5 12
## 4 4 4.89 4 1 0 2 4 6
## 5 5 6.06 5.75 0 1 3 1 4
## 6 6 7.39 4.38 0 0 1 0 1
## 7 7 5.56 3.63 0 1 2 2 4
## 8 8 7.5 5.63 1 1 8 7 15
## 9 9 7.67 5.25 0 0 3 2 5
## 10 10 6.64 4.78 0 0 5 7 12
## # … with 33 more rows
summary(node_measures)
## id efficacy trust district_site
## Length:43 Min. :4.610 Min. :3.630 Min. :0.0000
## Class :character 1st Qu.:5.670 1st Qu.:4.130 1st Qu.:0.0000
## Mode :character Median :6.780 Median :4.780 Median :0.0000
## Mean :6.649 Mean :4.783 Mean :0.4186
## 3rd Qu.:7.470 3rd Qu.:5.440 3rd Qu.:1.0000
## Max. :8.500 Max. :5.880 Max. :1.0000
## male in_degree out_degree degree
## Min. :0.0000 Min. :0.000 Min. : 0.000 Min. : 0.000
## 1st Qu.:0.0000 1st Qu.:2.000 1st Qu.: 1.000 1st Qu.: 3.000
## Median :0.0000 Median :3.000 Median : 2.000 Median : 4.000
## Mean :0.4419 Mean :3.326 Mean : 3.326 Mean : 6.651
## 3rd Qu.:1.0000 3rd Qu.:5.000 3rd Qu.: 4.000 3rd Qu.: 9.500
## Max. :1.0000 Max. :8.000 Max. :20.000 Max. :27.000
skim(node_measures)
| Name | node_measures |
| Number of rows | 43 |
| Number of columns | 8 |
| _______________________ | |
| Column type frequency: | |
| character | 1 |
| numeric | 7 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| id | 0 | 1 | 1 | 2 | 0 | 43 | 0 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| efficacy | 0 | 1 | 6.65 | 1.10 | 4.61 | 5.67 | 6.78 | 7.47 | 8.50 | ▅▅▃▇▃ |
| trust | 0 | 1 | 4.78 | 0.71 | 3.63 | 4.13 | 4.78 | 5.44 | 5.88 | ▆▆▅▆▇ |
| district_site | 0 | 1 | 0.42 | 0.50 | 0.00 | 0.00 | 0.00 | 1.00 | 1.00 | ▇▁▁▁▆ |
| male | 0 | 1 | 0.44 | 0.50 | 0.00 | 0.00 | 0.00 | 1.00 | 1.00 | ▇▁▁▁▆ |
| in_degree | 0 | 1 | 3.33 | 2.12 | 0.00 | 2.00 | 3.00 | 5.00 | 8.00 | ▅▇▂▅▂ |
| out_degree | 0 | 1 | 3.33 | 4.26 | 0.00 | 1.00 | 2.00 | 4.00 | 20.00 | ▇▁▁▁▁ |
| degree | 0 | 1 | 6.65 | 5.80 | 0.00 | 3.00 | 4.00 | 9.50 | 27.00 | ▇▃▂▁▁ |
We can now calculate some basic summary stats:
node_measures |>
group_by(district_site) |>
summarise(n = n(),
mean = mean(in_degree),
sd = sd(in_degree)
)
## # A tibble: 2 × 4
## district_site n mean sd
## <dbl> <int> <dbl> <dbl>
## 1 0 25 2.36 1.58
## 2 1 18 4.67 2.09
node_measures |>
group_by(district_site) |>
summarize(n = n(), mean = mean(out_degree), sd = sd(out_degree))
## # A tibble: 2 × 4
## district_site n mean sd
## <dbl> <int> <dbl> <dbl>
## 1 0 25 2.44 3.01
## 2 1 18 4.56 5.41
node_measures |>
group_by(district_site) |>
summarise(n = n(),
mean = mean(degree),
sd = sd(degree)
)
## # A tibble: 2 × 4
## district_site n mean sd
## <dbl> <int> <dbl> <dbl>
## 1 0 25 4.8 4.34
## 2 1 18 9.22 6.67
node_measures |>
group_by(district_site) |>
summarize(n = n(), mean = mean(trust), sd = sd(trust))
## # A tibble: 2 × 4
## district_site n mean sd
## <dbl> <int> <dbl> <dbl>
## 1 0 25 4.90 0.719
## 2 1 18 4.62 0.688
node_measures |>
group_by(district_site) |>
summarize(n = n(), mean = mean(efficacy), sd = sd(efficacy))
## # A tibble: 2 × 4
## district_site n mean sd
## <dbl> <int> <dbl> <dbl>
## 1 0 25 7.02 0.953
## 2 1 18 6.13 1.12
For our analysis, we’ll be incorporating the following:
Clear descriptions of the exploratory techniques and/or models (e.g., level of analysis, community detection, ERGMs, etc.) you applied to analyze your data.
Data visualizations that are attractive and easy to interpret, and include text or narrative for aiding their Interpretation by others.
Interpretations/meanings of specific metrics (e.g., counts, means, centrality measures, etc.) that your analysis generated.
For our analysis, we’ll be incorporating the following:
Clear descriptions of the exploratory techniques and/or models (e.g., level of analysis, community detection, ERGMs, etc.) you applied to analyze your data.
Data visualizations that are attractive and easy to interpret, and include text or narrative for aiding their Interpretation by others.
Interpretations/meanings of specific metrics (e.g., counts, means, centrality measures, etc.) that your analysis generated.
leader_network <- as.network(leader_edges,
vertices = female_leader_nodes)
leader_network
## Network attributes:
## vertices = 43
## directed = TRUE
## hyper = FALSE
## loops = FALSE
## multiple = FALSE
## bipartite = FALSE
## total edges= 143
## missing edges= 0
## non-missing edges= 143
##
## Vertex attribute names:
## district_site efficacy female trust vertex.names
##
## No edge attributes
class(leader_network)
## [1] "network"
summary(leader_network ~ edges + mutual)
## edges mutual
## 143 36
Our summary tells us that this network is comprised of 143 edges and 36 reciprocated dyads.
set.seed(589)
ergm_mod_1 <-ergm(leader_network ~ edges + mutual)
summary(ergm_mod_1)
## Call:
## ergm(formula = leader_network ~ edges + mutual)
##
## Monte Carlo Maximum Likelihood Results:
##
## Estimate Std. Error MCMC % z value Pr(>|z|)
## edges -3.1094 0.1247 0 -24.94 <1e-04 ***
## mutual 3.0984 0.2825 0 10.97 <1e-04 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Null Deviance: 2503.6 on 1806 degrees of freedom
## Residual Deviance: 892.4 on 1804 degrees of freedom
##
## AIC: 896.4 BIC: 907.4 (Smaller is better. MC Std. Err. = 0.9802)
This first model indicates that the negative estimate for the edge parameter implies a relatively low probability of confident exchange. However, there is a strong tendency for confidential-exchange ties among reciprocated dyads.
*This is consistent with the Unit 4 Case Study, as to be expected.
summary(leader_network ~ edges +
mutual +
transitive +
gwesp(0.25, fixed=T))
## edges mutual transitive
## 143.0000 36.0000 202.0000
## gwesp.OTP.fixed.0.25
## 116.2971
ergm_mod_2 <-ergm(leader_network ~ edges +
mutual +
gwesp(0.25, fixed=T))
summary(ergm_mod_2)
## Call:
## ergm(formula = leader_network ~ edges + mutual + gwesp(0.25,
## fixed = T))
##
## Monte Carlo Maximum Likelihood Results:
##
## Estimate Std. Error MCMC % z value Pr(>|z|)
## edges -3.9739 0.1562 0 -25.446 <1e-04 ***
## mutual 2.2925 0.3076 0 7.453 <1e-04 ***
## gwesp.OTP.fixed.0.25 1.0718 0.1306 0 8.205 <1e-04 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Null Deviance: 2503.6 on 1806 degrees of freedom
## Residual Deviance: 805.9 on 1803 degrees of freedom
##
## AIC: 811.9 BIC: 828.4 (Smaller is better. MC Std. Err. = 0.563)
In model 2, we see that the likelihood is more probable for mutuals with friend-of-a-friend ranking second in terms of probability.
*This is consistent with the Unit 4 Case Study
*This step using “female” in place of “male” from the original Case Study.
We’re completing the step below to test whether those who are female or have higher efficacy scores are more likely to either send or receive a confidential exchange:
ergm_3 <- ergm(leader_network ~ edges +
mutual +
gwesp(0.25, fixed=T) +
nodefactor('female') +
nodecov('efficacy')
)
summary(ergm_3)
## Call:
## ergm(formula = leader_network ~ edges + mutual + gwesp(0.25,
## fixed = T) + nodefactor("female") + nodecov("efficacy"))
##
## Monte Carlo Maximum Likelihood Results:
##
## Estimate Std. Error MCMC % z value Pr(>|z|)
## edges -4.14848 0.43177 0 -9.608 <1e-04 ***
## mutual 2.31873 0.32128 0 7.217 <1e-04 ***
## gwesp.OTP.fixed.0.25 1.04724 0.13356 0 7.841 <1e-04 ***
## nodefactor.female.1 -0.10981 0.06828 0 -1.608 0.108
## nodecov.efficacy 0.02307 0.03023 0 0.763 0.445
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Null Deviance: 2503.6 on 1806 degrees of freedom
## Residual Deviance: 802.2 on 1801 degrees of freedom
##
## AIC: 812.2 BIC: 839.7 (Smaller is better. MC Std. Err. = 0.5856)
Reciprocity and transitivity are, again, the primary drivers of network formation.
*I will compare the estimates for female and the results for male in the Communicate section below (see Key Findings and Insights).
We’ll repeat the same process, swapping efficacy for district site now:
ergm_4 <- ergm(leader_network ~ edges +
mutual +
gwesp(0.25, fixed=T) +
nodematch('female') +
nodecov('district_site')
)
summary(ergm_4)
## Call:
## ergm(formula = leader_network ~ edges + mutual + gwesp(0.25,
## fixed = T) + nodematch("female") + nodecov("district_site"))
##
## Monte Carlo Maximum Likelihood Results:
##
## Estimate Std. Error MCMC % z value Pr(>|z|)
## edges -4.04489 0.17550 0 -23.048 < 1e-04 ***
## mutual 2.27852 0.30645 0 7.435 < 1e-04 ***
## gwesp.OTP.fixed.0.25 1.02579 0.13565 0 7.562 < 1e-04 ***
## nodematch.female -0.14656 0.16244 0 -0.902 0.36694
## nodecov.district_site 0.19512 0.06918 0 2.821 0.00479 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Null Deviance: 2503.6 on 1806 degrees of freedom
## Residual Deviance: 795.8 on 1801 degrees of freedom
##
## AIC: 805.8 BIC: 833.3 (Smaller is better. MC Std. Err. = 0.4552)
In our final ERGM, district site poses more significance than gender for confidential exchange.
Next, we’ll test the goodness-of-fit using the gof()
function:
ergm_3_gof <- gof(ergm_3)
plot(ergm_3_gof)
One final check on our model is to run the
mcmc.diagnostics() function:
mcmc.diagnostics(ergm_3)
## Sample statistics summary:
##
## Iterations = 729088:14458880
## Thinning interval = 8192
## Number of chains = 1
## Sample size per chain = 1677
##
## 1. Empirical mean and standard deviation for each variable,
## plus standard error of the mean:
##
## Mean SD Naive SE Time-series SE
## edges -5.035 51.24 1.251 3.371
## mutual -1.920 16.50 0.403 1.094
## gwesp.OTP.fixed.0.25 -6.114 63.17 1.543 4.218
## nodefactor.female.1 -4.522 47.68 1.164 2.859
## nodecov.efficacy -69.151 693.81 16.942 45.764
##
## 2. Quantiles for each variable:
##
## 2.5% 25% 50% 75% 97.5%
## edges -93.0 -44.00 -5.000 32.00 92
## mutual -31.0 -15.00 -2.000 10.00 29
## gwesp.OTP.fixed.0.25 -108.3 -56.29 -6.855 39.59 118
## nodefactor.female.1 -84.0 -41.00 -8.000 30.00 90
## nodecov.efficacy -1264.4 -599.40 -72.850 433.29 1234
##
##
## Are sample statistics significantly different from observed?
## edges mutual gwesp.OTP.fixed.0.25 nodefactor.female.1
## diff. -5.0345856 -1.92009541 -6.1137418 -4.5217651
## test stat. -1.4936027 -1.75476657 -1.4494889 -1.5816449
## P-val. 0.1352795 0.07929924 0.1472011 0.1137307
## nodecov.efficacy (Omni)
## diff. -69.1510674 NA
## test stat. -1.5110483 20.727985118
## P-val. 0.1307762 0.001034567
##
## Sample statistics cross-correlations:
## edges mutual gwesp.OTP.fixed.0.25
## edges 1.0000000 0.9788077 0.9914856
## mutual 0.9788077 1.0000000 0.9807755
## gwesp.OTP.fixed.0.25 0.9914856 0.9807755 1.0000000
## nodefactor.female.1 0.9500401 0.9236639 0.9354160
## nodecov.efficacy 0.9988509 0.9778066 0.9908245
## nodefactor.female.1 nodecov.efficacy
## edges 0.9500401 0.9988509
## mutual 0.9236639 0.9778066
## gwesp.OTP.fixed.0.25 0.9354160 0.9908245
## nodefactor.female.1 1.0000000 0.9495416
## nodecov.efficacy 0.9495416 1.0000000
##
## Sample statistics auto-correlation:
## Chain 1
## edges mutual gwesp.OTP.fixed.0.25 nodefactor.female.1
## Lag 0 1.0000000 1.0000000 1.0000000 1.0000000
## Lag 8192 0.7359410 0.7353787 0.7421293 0.6458465
## Lag 16384 0.5640220 0.5630819 0.5732219 0.4677249
## Lag 24576 0.4359850 0.4320743 0.4401167 0.3563583
## Lag 32768 0.3184500 0.3119342 0.3188097 0.2544098
## Lag 40960 0.2435244 0.2477540 0.2437661 0.1984136
## nodecov.efficacy
## Lag 0 1.0000000
## Lag 8192 0.7370290
## Lag 16384 0.5656391
## Lag 24576 0.4372585
## Lag 32768 0.3188430
## Lag 40960 0.2426378
##
## Sample statistics burn-in diagnostic (Geweke):
## Chain 1
##
## Fraction in 1st window = 0.1
## Fraction in 2nd window = 0.5
##
## edges mutual gwesp.OTP.fixed.0.25
## 1.575412 1.573830 1.476240
## nodefactor.female.1 nodecov.efficacy
## 1.532828 1.511065
##
## Individual P-values (lower = worse):
## edges mutual gwesp.OTP.fixed.0.25
## 0.1151614 0.1155267 0.1398795
## nodefactor.female.1 nodecov.efficacy
## 0.1253181 0.1307719
## Joint P-value (lower = worse): 0.07172014
##
## Note: MCMC diagnostics shown here are from the last round of
## simulation, prior to computation of final parameter estimates.
## Because the final estimates are refinements of those used for this
## simulation run, these diagnostics may understate model performance.
## To directly assess the performance of the final model on in-model
## statistics, please use the GOF command: gof(ergmFitObject,
## GOF=~model).
In the following section, we will cover the following:
Key finding and insights in response to your research questions.
Suggests potential action that you and/or your target audience to better understand and improve the context in which your data product is intended to inform.
Discusses the limitations and any ethical/legal issues taken into consideration, including acknowledgments any reference materials used.
As a reminder, this analysis sought to address the following research question:
Are female school leaders more likely to confide in colleagues of their own gender than their male counterparts?
Using the Unit 4 Case Study for comparison, these are the results that this analysis has generated.
In this section, I will be using the results from the Unit 4 Case Study ERGMS, to compare and contrast the findings from this analysis.
From the Unit 4 Case Study, there was a slight but not statistically significant tendency towards male leaders being more likely to send or receive ties (0.10622). In comparison, this is even less for female school leaders (-0.10830); efficacy is a better predictor (0.02291) which is nearly identical to the efficacy return from the Unit 4 Case Study (0.2230).
The results from the Unit 4 Case Study and this analysis are very similar with district site having more of an effect. The model estimates from Unit 4 were male (-0.15294) and district site (0.19149) while this analysis estimated female (-0.1491) and district site (0.2013).
Overall, reciprocity and transitivity proved the most statistically significant. While the Unit 4 Case Study and this analysis do generate similar estimates, there is a slightly more significant tendency towards male leaders being more likely to send or receive ties. To answer the research question guiding this analysis, female school leaders are less likely to confide in colleagues of the same gender than their male counterparts. However, there is not a drastic distinction between the two.
One of the ways in which I could anticipate this analysis being used is to extend the scope of the results so that these predictive measures can be used in various educational settings. What I hoped to determine was how significant gender was in predicting confidential exchanges. In this context, we found that other attributes are more significant overall with a slight lean towards greater disclosure for male-to-male colleagues. We tested this against attributes such efficacy scores and district site. In the future, it would be great to include additional attributes that were not considered such as degree or other relational measures other than reciprocity and transitivity. In a similar vein to the Unit 5 Case Study, these predictive attributes could be used to improve employee retention and satisfaction especially in educational settings where individuals often have lower pay and resources available to them. (However, I think that this would also be very interesting to compare other industries as well!).
Consistent with the findings of the Unit 4 Case Study, reciprocity and transitivity are the two attributes with the most significant impact on confidential exchanges between school leaders. There are no ethical/legal issues that I foresee with this analysis as long as anonymity is maintained and this information or concepts explored are not used to exploit individuals.
Carolan, Brian. 2014. “Social Network Analysis and Education: Theory, Methods & Applications.” https://doi.org/10.4135/9781452270104.
leader_measures <- leader_graph |>
activate(nodes) |>
mutate(in_degree = centrality_degree(mode = "in")) |>
mutate(out_degree = centrality_degree(mode = "out"))
leader_measures
## # A tbl_graph: 43 nodes and 143 edges
## #
## # A directed simple graph with 4 components
## #
## # Node Data: 43 × 7 (active)
## id efficacy trust district_site male in_degree out_degree
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 6.06 4 1 0 5 0
## 2 2 6.56 5.63 1 0 1 0
## 3 3 7.39 4.63 1 0 7 5
## 4 4 4.89 4 1 0 2 4
## 5 5 6.06 5.75 0 1 3 1
## 6 6 7.39 4.38 0 0 1 0
## # … with 37 more rows
## #
## # Edge Data: 143 × 2
## from to
## <int> <int>
## 1 3 1
## 2 3 27
## 3 3 28
## # … with 140 more rows