The final activity for each learning lab provides space to work with data and to reflect on how the concepts and techniques introduced in each lab might apply to your own research.

To earn a badge for each lab, you are required to respond to a set of prompts for two parts: 

Part I: Reflect and Plan

Use your institutional library, Google Scholar, or search engine of your choice to locate a research article, presentation, or resource that applies social network analysis to an educational context or topic of interest. More specifically, locate a network study that makes use of statistical models to explain or predict an education related process or outcome. You are also welcome to select one of the research papers listed in the essential readings that may have piqued your interest.

  1. Provide an APA citation for your selected study.

    • Mauldin, R. L., Barros-Lane, L., Tarbet, Z., Fujimoto, K., & Narendorf, S. C. (2022). Cohort-based education and other factors related to student peer relationships: A mixed methods social network analysis. Education Sciences, 12(3), 205.
  2. What research questions were the authors of this study trying to address and why did they consider these questions important?

    • RQ 1 (Qualitative): After graduation or near the end of their programs, what are MSW students’ perspectives of their peer relationships during the program and the role of cohort-based education on their peer relationships?
    • RQ 2 (Qualitative and Quantitative): What individual, institutional (e.g., cohort-based learning), dyadic, and network structural factors are associated with MSW student friendships?
    • They stated that student peer interaction support graduate students’ successful completion of their study. They consider these questions are important because the relationships of the potentially complex interplay of individual graduate student’s attributes and cohort membership and the longitudinal effects of cohort membership on peer relationships should be understood.
  3. What is being modeled to address these questions: ties in complete networks, individual actor attributes, or groups of actors?

    • ties: shared classes after the first semester (# of classes each pair of students had taken together); social ties (friendship with individuals) & academic ties (academic discussion interactions);
    • The authors modeled the correlates of students’ friendship ties with a ERGM.
    • Their ties and demographic, psychsocial attributes, etc. were considered.
  4. What procedure was used and what, if any, covariates were included in the models?

      • The authors modeled the correlates of students’ friendship ties with a ERGM.
    • Their ties and demographic (age, gnder, race/ethnicity), psychsocial attributes, etc. were considered. individual-level dependent variables and a few additional dyadic and structural variables wee included into the model at a time.
  5. What were the results of these analyses and were they “statistically significant”? If so, what does mean in a network context?

    • “Friendships were more likely to be reported by older students (p < 0.01) and male students (p < 0.001) than by their counterparts. Male students were also more likely than female students to be named by other students as a friend (p < 0.05). Hispanic/Latino(a) students (p < 0.05) were more likely to report friendships, and Black/African American students were more likely to be named as friends (p < 0.01) than white students were. Previously established relationships were also important for friendships at the midpoint of the second year of the program, particularly multiplex relationships. The more types of relationships a student reported having with a peer at the end of the first semester (e.g., friendship and academic ties compared to only a friendship), the greater the likelihood the student would report a friendship tie in the second year with that peer (p < 0.001). Having taken classes together after the cohort experience ended at the end of the first semester was also salient. The more classes a pair of students shared, the more likely they would have a friendship tie (p < 0.001) (p. 17).”
    • Being in the same cohort during the first semester was a highly significant predictor (p<0.001) of being friends mid-way through the second year of the program.
    • in the fully adjusted final model that included multiplex relationships at the end of the first semester, shared cohort membership was no longer a significant predictor of friendships mid-way through the second year of the program. Instead, having more classes together after the first semester (p < 0.001) and having at least one type of relationship at the end of the first semester (p < 0.001) were significant predictors of later friendships.

Think about a network that you are a part of, or may be interested in studying, and answer the following questions:

  1. What is a research question that you might ask about this network that a statistical model for networks (e.g. QAP, P*, ERGM, etc.) might help to address?

    • They used various individual attributes in their models. I would probably also ask their career goals after graduation because those people in the same or similar interests of their career goals and plans probably have more interactions, thereby building stronger friendship.
  2. What model would be most appropriate for addressing this question and why?

    • That would be almost same as the explained models and analyses in the paper using ERGM but including each individual’s career goals as one of the attributes.

Part II: Data Product

In our SNA Lab 4 Case Study, we only scratched the surface on the number of network and node attributes properties that can be tested using ERGMs. Take a look at a table of common ergm-terms or type “ergm-terms” into the help menu of the files pane for some additional examples.

Using one of the data sets provided in the data folder, your goal for this lab is to extend the ERGM analysis from our case study by adding a new parameter/term to our model. For example, you may be interested in examining how shared characteristics among school leaders might help explain tie formation, such as gender, level of trust in colleagues, or whether they work at the school or district level.

Alternatively, you may use your own data set to estimate models akin to those we estimated in the guided practice. 

I highly recommend creating a new R script in your lab-4 folder to complete this task. When your code is ready to share, use the code chunk below to share only the code and comments necessary to run and undestand your analysis, then answer the questions that follow.

# YOUR FINAL CODE HERE
library(readxl)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.2     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.2     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.1     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(igraph)
## 
## Attaching package: 'igraph'
## 
## The following objects are masked from 'package:lubridate':
## 
##     %--%, union
## 
## The following objects are masked from 'package:dplyr':
## 
##     as_data_frame, groups, union
## 
## The following objects are masked from 'package:purrr':
## 
##     compose, simplify
## 
## The following object is masked from 'package:tidyr':
## 
##     crossing
## 
## The following object is masked from 'package:tibble':
## 
##     as_data_frame
## 
## The following objects are masked from 'package:stats':
## 
##     decompose, spectrum
## 
## The following object is masked from 'package:base':
## 
##     union
library(tidygraph)
## 
## Attaching package: 'tidygraph'
## 
## The following object is masked from 'package:igraph':
## 
##     groups
## 
## The following object is masked from 'package:stats':
## 
##     filter
library(ggraph)
library(skimr)
library(janitor)
## 
## Attaching package: 'janitor'
## 
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
library(statnet)
## Loading required package: tergm
## Loading required package: ergm
## Loading required package: network
## 
## 'network' 1.18.1 (2023-01-24), part of the Statnet Project
## * 'news(package="network")' for changes since last version
## * 'citation("network")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 
## 
## Attaching package: 'network'
## 
## The following objects are masked from 'package:igraph':
## 
##     %c%, %s%, add.edges, add.vertices, delete.edges, delete.vertices,
##     get.edge.attribute, get.edges, get.vertex.attribute, is.bipartite,
##     is.directed, list.edge.attributes, list.vertex.attributes,
##     set.edge.attribute, set.vertex.attribute
## 
## 
## 'ergm' 4.5.0 (2023-05-27), part of the Statnet Project
## * 'news(package="ergm")' for changes since last version
## * 'citation("ergm")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 
## 'ergm' 4 is a major update that introduces some backwards-incompatible
## changes. Please type 'news(package="ergm")' for a list of major
## changes.
## 
## Loading required package: networkDynamic
## 
## 'networkDynamic' 0.11.3 (2023-02-15), part of the Statnet Project
## * 'news(package="networkDynamic")' for changes since last version
## * 'citation("networkDynamic")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 
## Registered S3 method overwritten by 'tergm':
##   method                   from
##   simulate_formula.network ergm
## 
## 'tergm' 4.2.0 (2023-05-30), part of the Statnet Project
## * 'news(package="tergm")' for changes since last version
## * 'citation("tergm")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 
## 
## Attaching package: 'tergm'
## 
## The following object is masked from 'package:ergm':
## 
##     snctrl
## 
## Loading required package: ergm.count
## 
## 'ergm.count' 4.1.1 (2022-05-24), part of the Statnet Project
## * 'news(package="ergm.count")' for changes since last version
## * 'citation("ergm.count")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 
## Loading required package: sna
## Loading required package: statnet.common
## 
## Attaching package: 'statnet.common'
## 
## The following object is masked from 'package:ergm':
## 
##     snctrl
## 
## The following objects are masked from 'package:base':
## 
##     attr, order
## 
## sna: Tools for Social Network Analysis
## Version 2.7-1 created on 2023-01-24.
## copyright (c) 2005, Carter T. Butts, University of California-Irvine
##  For citation information, type citation("sna").
##  Type help(package="sna") to get started.
## 
## 
## Attaching package: 'sna'
## 
## The following objects are masked from 'package:igraph':
## 
##     betweenness, bonpow, closeness, components, degree, dyad.census,
##     evcent, hierarchy, is.connected, neighborhood, triad.census
## 
## Loading required package: tsna
## 
## 'statnet' 2019.6 (2019-06-13), part of the Statnet Project
## * 'news(package="statnet")' for changes since last version
## * 'citation("statnet")' for citation information
## * 'https://statnet.org' for help, support, and other information
## 
## 
## There are updates for the following statnet packages on CRAN:
##                Installed ReposVer Built  
## ergm           "4.5.0"   "4.6.0"  "4.3.0"
## network        "1.18.1"  "1.18.2" "4.3.0"
## networkDynamic "0.11.3"  "0.11.4" "4.3.0"
## sna            "2.7-1"   "2.7-2"  "4.3.0"
## Restart R and use "statnet::update_statnet()" to get the updates.
leader_nodes <- read_csv("data/school-leader-nodes.csv")
## Rows: 43 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (5): id, efficacy, trust, district_site, male
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
leader_edges <- read_csv("data/school-leader-edges.csv")
## Rows: 143 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (2): from, to
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
?as.network
leader_network <- as.network(leader_edges,
                             vertices = leader_nodes)
class(leader_network)
## [1] "network"
class(leader_nodes)
## [1] "spec_tbl_df" "tbl_df"      "tbl"         "data.frame"
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 male trust vertex.names 
## 
## No edge attributes
my_network ~ ergm_term_1 + ergm_term_2 + ergm_term_3
## my_network ~ ergm_term_1 + ergm_term_2 + ergm_term_3
#edge
#nodecovar 

# ensure reproducibility of our model
set.seed(890) 
# fit our ergm model 
ergm_mod_1 <-ergm(leader_network ~ edges + mutual) #we only include network terms
## Starting maximum pseudolikelihood estimation (MPLE):
## Obtaining the responsible dyads.
## Evaluating the predictor and response matrix.
## Maximizing the pseudolikelihood.
## Finished MPLE.
## Starting Monte Carlo maximum likelihood estimation (MCMLE):
## Iteration 1 of at most 60:
## Warning: 'glpk' selected as the solver, but package 'Rglpk' is not available;
## falling back to 'lpSolveAPI'. This should be fine unless the sample size and/or
## the number of parameters is very big.
## Optimizing with step length 1.0000.
## The log-likelihood improved by 0.0065.
## Convergence test p-value: 0.0032. Converged with 99% confidence.
## Finished MCMLE.
## Evaluating log-likelihood at the estimate. Fitting the dyad-independent submodel...
## Bridging between the dyad-independent submodel and the full model...
## Setting up bridge sampling...
## Using 16 bridges: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 .
## Bridging finished.
## 
## This model was fit using MCMC.  To examine model diagnostics and check
## for degeneracy, use the mcmc.diagnostics() function.
#another common term for reciprocity is "mutual") only need directed network.
# get summary statistics for our model
#always include 'mutual' when it's directed!!!!! ********
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.1069     0.1275      0  -24.38   <1e-04 ***
## mutual   3.1130     0.2970      0   10.48   <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:  895.2  on 1804  degrees of freedom
##  
## AIC: 899.2  BIC: 910.2  (Smaller is better. MC Std. Err. = 1.399)
ergm_5 <- ergm(leader_network ~ edges +
                 mutual +
                 gwesp(0.25, fixed=T) +
                 nodematch('district_site')+
                 nodecov('trust') +
                 nodecov('efficacy')
)
## Starting maximum pseudolikelihood estimation (MPLE):
## Obtaining the responsible dyads.
## Evaluating the predictor and response matrix.
## Maximizing the pseudolikelihood.
## Finished MPLE.
## Starting Monte Carlo maximum likelihood estimation (MCMLE):
## Iteration 1 of at most 60:
## Optimizing with step length 0.3634.
## The log-likelihood improved by 1.8711.
## Estimating equations are not within tolerance region.
## Iteration 2 of at most 60:
## Optimizing with step length 0.9231.
## The log-likelihood improved by 2.1201.
## Estimating equations are not within tolerance region.
## Iteration 3 of at most 60:
## Optimizing with step length 1.0000.
## The log-likelihood improved by 0.3738.
## Estimating equations are not within tolerance region.
## Iteration 4 of at most 60:
## Optimizing with step length 1.0000.
## The log-likelihood improved by 0.0502.
## Convergence test p-value: 0.9223. Not converged with 99% confidence; increasing sample size.
## Iteration 5 of at most 60:
## Optimizing with step length 1.0000.
## The log-likelihood improved by 0.0110.
## Convergence test p-value: 0.8502. Not converged with 99% confidence; increasing sample size.
## Iteration 6 of at most 60:
## Optimizing with step length 1.0000.
## The log-likelihood improved by 0.0111.
## Convergence test p-value: 0.3377. Not converged with 99% confidence; increasing sample size.
## Iteration 7 of at most 60:
## Optimizing with step length 1.0000.
## The log-likelihood improved by 0.0304.
## Convergence test p-value: 0.1648. Not converged with 99% confidence; increasing sample size.
## Iteration 8 of at most 60:
## Optimizing with step length 1.0000.
## The log-likelihood improved by 0.0092.
## Convergence test p-value: 0.0029. Converged with 99% confidence.
## Finished MCMLE.
## Evaluating log-likelihood at the estimate. Fitting the dyad-independent submodel...
## Bridging between the dyad-independent submodel and the full model...
## Setting up bridge sampling...
## Using 16 bridges: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 .
## Bridging finished.
## 
## This model was fit using MCMC.  To examine model diagnostics and check
## for degeneracy, use the mcmc.diagnostics() function.
summary(ergm_5)
## Call:
## ergm(formula = leader_network ~ edges + mutual + gwesp(0.25, 
##     fixed = T) + nodematch("district_site") + nodecov("trust") + 
##     nodecov("efficacy"))
## 
## Monte Carlo Maximum Likelihood Results:
## 
##                         Estimate Std. Error MCMC % z value Pr(>|z|)    
## edges                   -4.30137    0.53956      0  -7.972   <1e-04 ***
## mutual                   2.18591    0.32015      0   6.828   <1e-04 ***
## gwesp.OTP.fixed.0.25     1.03395    0.13516      0   7.650   <1e-04 ***
## nodematch.district_site  0.62706    0.13211      0   4.746   <1e-04 ***
## nodecov.trust            0.02560    0.04840      0   0.529    0.597    
## nodecov.efficacy        -0.01773    0.03106      0  -0.571    0.568    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##      Null Deviance: 2503.6  on 1806  degrees of freedom
##  Residual Deviance:  781.3  on 1800  degrees of freedom
##  
## AIC: 793.3  BIC: 826.3  (Smaller is better. MC Std. Err. = 0.7324)
  1. What did you predict would be the results of this model?

    • I assumed that district level and trust level might be significant factors from the model.
  2. What were the actual results of your new model?

    • This model tests whether those who work at the same district-site level, have higer efficacy scores, or have higher trust level are more likely to either send or receive a confidential exhcnage controlling for edge, reciprocity, and transitivity. Result showed a strong tendency for confidential-exchange ties occurs between two nodes/people who are in same district.
  3. How would you frame a research question that this model helps address?

    • Controlling for edge, reciprocity, and transitivity, are school leaders more likely to confide in collegues who work at the same district-site level, have higer efficacy scores, or have higher trust level?

To receive credit for this assignment and earn your first SNA LASER Badge, you will first need to knit and publish this page to Posit Cloud. Next, share the link to published webpage under one of the Badge Artifact columns on the 2023 LASER Scholar Information and Documents spreadsheet: https://go.ncsu.edu/laser-sheet. Once your instructor has checked your link, you will be provided a physical version of the badge pictured at the top of this document!