Introduction

The purpose of this homework is to familiarize you with estimating exponential random graph models (ERGMs) in R. Please review the following materials before beginning this homework:


Part I: Working with an Undirected Network

For this part of the homework you will use data from Thomas Grund and James Densley’s study of ties among members of an inner-city gang in London, England. The network is undirected, binary ties collected from anonymized arrests data. We will refer to this network as the LondonGangNet. Note that the object is of class network.

Regarding the attributes:

  • Birthplace records where they were born where the values are: 1 = West Africa, 2= Caribbean, 3= UK, 4= East Africa
  • Prison indicates whether they have been to prison
  • Age is their age in years
  • Convictions is the number of convictions a gang member has


For the LondonGangNet network, do the following:

  1. Plot the LondonGangNet and plot a random network with the same number of edges.
  2. Based on the plots, how does the LondonGangNet differ from the random network?
  3. Estimate an ERGM where ties form at random. Interpret the coefficient.
  4. Examine and describe the relationship between degree and the attribute Prison.
  5. Estimate an ERGM where gang members differ in their degree based on the attribute Prison. Interpret the coefficient.
  6. Estimate an ERGM where gang members differ in their degree based on the attribute Convictions. Interpret the coefficient.
  7. Examine the mixing matrix for Birthplace. What is the interpretation of this matrix?
  8. Estimate an ERGM where gang members of the same Birthplace are more likely to form ties.
  9. What is the probability of a tie between gang members who are from the same Birthplace?
  10. Estimate an ERGM where gang members of similar Age are more likely to form ties.
  11. What is the probability of a tie between gang members who are the same Age?
  12. Simulate a network from the Prison or (and?) Convictions ERGMs (i.e. #5 or/and #6).
  13. Plot the simulated network from #12 and the LondonGangNet, identifying nodes based on Prison or Conviction in both plots.
  14. Simulate a network from the Birthplace or (and?) Age ERGMs (i.e. #8 or/and #10).
  15. Plot the simulated network from #14 and the LondonGangNet, identifying nodes based on Birthplace or Age in both plots.
  16. Evaluate the goodness of fit for the models in #5, #6, #8, or #10.
  17. Which model provides the best fit to the data? How do you know?


Part II: Working with a Directed Network

For this part of the homework you will use data from WO-PINS study. The network is directed, binary ties collected from women in a prison unit. We will refer to this network as trustNet. Note that the object is of class network.

Regarding the attributes:

  • White records whether the respondent is white and 0 is non-white
  • YearsOnUnit indicates the number of years the individual has been on the unit


For the trustNet network, do the following:

  1. Plot the trustNet and plot a random network with the same number of edges.
  2. Based on the plots, how does the trustNet differ from the random network?
  3. Estimate an ERGM where ties form at random. Interpret the coefficient.
  4. Examine and describe the relationship between degree and the attribute White.
  5. Examine and describe the relationship between degree and the attribute YearsOnUnit of experience.
  6. Estimate an ERGM where individuals differ in their degree based on the attribute White. Interpret the coefficient.
  7. Estimate an ERGM where individuals differ in their degree based on the attribute YearsOnUnit. Interpret the coefficient.
  8. Examine the mixing matrix for White. What is the interpretation of this matrix?
  9. Estimate an ERGM where are more likely to form ties based on White (i.e. homophily for the attribute White).
  10. What is the probability of a tie between two individuals who are both white?
  11. What is the probability of a tie between two individuals who are both non-white?
  12. Estimate an ERGM where ties are reciprocated. Interpret the coefficient.
  13. Simulate a network from the ERGM in #6, #7, or (and?) #9.
  14. Plot the simulated network from #13 and the trustNet, identifying nodes based on White or (and?) YearsOnUnit in both plots.
  15. Evaluate the goodness of fit for the models in #6, #7, #9, or #12.
  16. Which model provides the best fit to the data? How do you know?



How to Submit

Download the Homework 5 template prior to beginning. The template contains code for accessing the data files.


Knitting to HTML

When you have completed your homework, click the “Knit” button to render your .RMD file into a .HTML report.


Special Instructions

Upload both your .RMD and .HTML files to the appropriate assignment on the Canvas page for this course. Just click the “Start Assignment” button to upload the files. This assignment is DUE on 4/3.


Before You Submit

Remember to ensure the following before submitting your assignment.

  1. Name your files using this format: Hmwk-##-LastName.rmd and Hmwk-##-LastName.html
  2. Show both the solution for your code and write out your answers in the body text

See Google’s R Style Guide for examples of common conventions.


Common Knitting Issues

.RMD files are knit into .HTML and other formats procedural, or line-by-line.

  • An error in code when knitting will halt the process; error messages will tell you the specific line with the error
  • Certain functions like install.packages() or setwd() are bound to cause errors in knitting
  • Altering a dataset or variable in one chunk will affect their use in all later chunks
  • If an object is “not found”, make sure it was created or loaded with library() in a previous chunk

If All Else Fails: If you cannot determine and fix the errors in a code chunk that’s preventing you from knitting your document, add eval = FALSE inside the brackets of {r} at the beginning of a chunk to ensure that R does not attempt to evaluate it, that is: {r eval = FALSE}. This will prevent an erroneous chunk of code from halting the knitting process.




Back to SAND main page


Please report any needed corrections to the Issues page. Thanks!