Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
This post is based on an interdisciplinary collaboration (between anthropologists and psychologists) with Kate Ellis-Davies and Sheina Lew-Levy (who initiated the project), Eleanor Fleming and Adam Boyette. The work was recently published in Field Methods and is available here: Demonstrating the Utility of Egocentric Relational Event Modeling Using Focal Follow Data from Congolese BaYaka Children and Adolescents Engaging in Work and Play. I led on the statistical modeling of the data including adapting the implementation for focal follow data (which I’ll explain more about in part 2) with the other authors contributing knowledge of the theory and literature (as we were keen to ensure that we demonstrated the approach using real data addressing a substantive research question). My only regret about the project is that, as of writing, I’ve only met been able to meet one of my co-authors in person.
The purpose of this blog post is to give a bit more context to the approach and make the it easier to learn about the egocentric relational event model (EREM) by providing access to the R code and data. A relational event is a discrete event involving an actor and one or more targets. For example you might observe children in a play group and code their interactions as discrete events in time such as child 1 approaching child 2, child 2 offering child 1 a toy and so on. Relational event models are one approach to modeling such data (and fall under the broader umbrella of network methods). However, not all relational event data involves such complete and detailed network data. In some cases you are only interested in or have access to data involving one actor at a time in relation to their environment (which may include interactions with other actors). Such data lend themselves to analysis using the egocentric relational event model. Although this sort of data might seem limiting it is often very rich. In particular it lends itself to analysing patterns of sequences among discrete non-overlapping events.
The model comes in two flavours: ordinal and interval. In the ordinal version you only have access to information about the order of events. In the interval version you have (or can infer) start and finish times for each event. This means that you can model not only patterns in the sequences of events but their duration. For example, does a particular type of event increase the frequency or duration of another event?
The Marcum and Butts example uses the American Time Use Survey in which “measures the amount of time people spend doing various activities, such as paid work, childcare, volunteering, and socializing”. Using these data we can answer questions such as how often does sleep get interrupted by other activities, which activities cause more sleep interruptions (or more prosaic questions such as how much time do people spend doing a particular activity). We can also look at how covariates impact the frequency or duration of events. For example, are some sleep interruptions more common for men than women?
Please note that the following examples assume you have some familiarity with linear regression models (and ideally generalised linear models for discrete data such as logistic or Poisson regression). You’ll also need a working knowledge of R (or at least similar statistical software programming environments). If R is new to you I’d suggest finding a tutorial on using R with RStudio first. (There are a lot of these online – including many videos.)
In this first part I’m actually going to focus not on our data but a paper by Marcum and Butts (2015). This introduces the egocentric relational event model and is a fantastic resource for a lot of the technical details of the model. You can run an EREM with the relevent package in R, but setting up and running EREMs is more than a little bit fiddly. Marcum and Butts’ have made this easier with the informR package in R. This is essentially a helper package to make running EREM models easier. They include a really useful tutorial with R code in the paper. So if you want to learn about the EREM I’d suggest working through the relevant parts of the paper (no pun intended). To make this easier (I hope) I’ve added some commentary and made some minor tweaks to their example.
You can access the Marcum and Butts (2015) worked example here.
In part 2 I’ll focus on our Field Methods paper.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.