Skip to content

Commit 74c183c

Browse files
committed
Finalizing slides
1 parent ff53b6e commit 74c183c

12 files changed

+278
-212
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## What drives social networks? A gentle introduction to exponential random graph models (with a focus on small networks)
2+
3+
Talk at the LA East R User Group meeting, June 10 2019.
4+
5+
The slides for this talk can be downloaded in [presentation mode](slides.pdf) or [handout mode](slides-handout.pdf).
6+
7+

bibliography.bib

+15
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,19 @@ @article{sampson1969novitiate
174174
title={A novitiate in a period of change: An experimental and case study of social relationships.},
175175
author={Sampson, Samuel F},
176176
year={1969}
177+
}
178+
179+
@Manual{vegayon2018,
180+
title = {{{ergmito: Exponential Random Graph Models for Small Networks}}},
181+
author = {George {Vega Yon}},
182+
year = {2018},
183+
note = {R package version 0.1-0},
184+
url = {https://github.com/muriteams/ergmito},
185+
}
186+
187+
@Misc{vegayon2019,
188+
title = {{Exponential Random Graph models for Little Networks}},
189+
author = {George {Vega Yon} and Kayla {de la Haye}},
190+
year = {{2019}},
191+
eprint = {{arXiv:1904.10406}},
177192
}

ergmitos-header.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@
5858
\usepackage{tabularx, booktabs}
5959
\usepackage{tcolorbox} % Fancy looking boxes
6060

61-
% \bibliography{bibliography.bib}
61+
% \bibliography{bibliography.bib}
859 KB
Loading
1.88 MB
Binary file not shown.

fig/lifecycle-experimental-orange.pdf

9.45 KB
Binary file not shown.

fig/logo.png

75.6 KB
Loading

fig/the-end.jpg

97.8 KB
Loading

slides-handout.pdf

2.15 MB
Binary file not shown.

slides.Rmd

+101-46
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ output:
1515
fontsize: 10pt
1616
aspectratio: 169
1717
nocite: |
18-
@Csardi2015, @knitr, @rmarkdown, @R, @Handcock2006, @Wasserman1996
18+
@Csardi2015, @knitr, @rmarkdown, @R, @Handcock2006, @Wasserman1996, |
19+
@hunter2008, @Handcock2018, @vegayon2018, @vegayon2019
1920
bibliography: bibliography.bib
20-
handout: true
21+
handout: false
2122
---
2223

2324
```{r setup, include=FALSE}
@@ -40,27 +41,27 @@ knitr::opts_chunk$set(echo = TRUE, smallsize=TRUE, out.width = ".6\\linewidth",
4041
\caption{Friendship network of a UK university faculty. Source: \textbf{igraphdata} R package (Csardi, 2015). Figure drawn using the R package \textbf{netplot} (yours truly, https://github.com/usccana/netplot)}
4142
\end{figure}
4243

43-
## What drives \sout{\color{USCCardinal}social} networks?
44+
<!-- ## What drives \sout{\color{USCCardinal}social} networks? -->
4445

45-
If \color{gray}\textit{[blank]}\color{black}{} asks you to predict a network\pause
46+
<!-- If \color{gray}\textit{[blank]}\color{black}{} asks you to predict a network\pause -->
4647

47-
\Huge What kind of model?\pause
48+
<!-- \Huge What kind of model?\pause -->
4849

49-
\Huge What features would you include?\pause
50+
<!-- \Huge What features would you include?\pause -->
5051

51-
\normalsize
52+
<!-- \normalsize -->
5253

53-
## Exponential Family Random Graph Models (ERGMs)
54+
## What drives \sout{\color{USCCardinal}social} networks?
5455

55-
Why are you and I are \color{gray}\textit{[blank]} \color{black}? (friends, collaborators, etc.)
56+
Why are you and I are \color{gray}\textit{[blank]} \color{black}? (friends, collaborators, etc.)\pause
5657

5758
```{r ergm-terms, echo=FALSE}
5859
knitr::include_graphics("fig/friendly-terms.pdf")
5960
```
6061

6162
\pause Let's build a model for this!
6263

63-
## ERGMs from scratch
64+
## Exponential Family Random Graph Models (ERGMs)
6465

6566
We need to build a probability function for \includegraphics[width=.05\linewidth]{fig/g1.pdf}...\pause
6667

@@ -85,7 +86,7 @@ We need to build a probability function for \includegraphics[width=.05\linewidth
8586
\end{tcolorbox}\pause
8687
\begin{tcolorbox}[width=\tbw]
8788
$\frac{\exp{\theta_{1} \times \#edges + \theta_{2} \times \#homophilic\;ties + \dots}}{\sum \exp{\dots}}$
88-
\end{tcolorbox}\pause
89+
\end{tcolorbox}
8990

9091
\end{centering}
9192

@@ -107,12 +108,12 @@ You got yourself an ERGM!
107108

108109
\centering
109110

110-
There is one problem with this model ...
111+
There is one problem with this model ... \linebreak[4]
111112

112-
\includegraphics[width = .5\linewidth]{fig/parts-of-ergm.pdf}\pause
113+
\includegraphics[width = .5\linewidth]{fig/parts-of-ergm.pdf}\pause \linebreak[4]
113114

114115
\large because of \color[HTML]{af0000}$\GRAPH$\color{black},
115-
the \color[HTML]{5726e7} \textbf{normalizing constant}\color{black}{} is \linebreak[4] a summation of $2^{n(n-1)}$ terms \includegraphics[width=.05\linewidth]{fig/scared.png}!\normalsize\pause
116+
the \color[HTML]{5726e7} \textbf{normalizing constant}\color{black}{} is \linebreak[4] a summation of $2^{n(n-1)}$ terms \includegraphics[width=.05\linewidth]{fig/scared.png}!\normalsize
116117

117118
-----
118119

@@ -141,16 +142,20 @@ To solve this, instead of directly computing this function, estimation is done b
141142

142143
## Let's get going
143144

144-
We will use the famous Monk data from @sampson1969novitiate
145+
We will use the famous Monk data from @sampson1969novitiate \pause
145146

146147
```{r ergm-monks, message=FALSE}
147148
library(ergm)
148149
data(samplk, package="ergm")
150+
```
151+
\pause
152+
This is an object of class network
149153

150-
# A glimpse into a network object (from the network package loaded with ergm)
154+
```{r ergm-monk-print}
151155
samplk1
152156
```
153157

158+
154159
---
155160

156161
```{r ermg-vis, warning=FALSE, message=FALSE, out.width=".5\\linewidth"}
@@ -172,26 +177,66 @@ gplot(samplk1, vertex.cex = degree(samplk1)/4, vertex.col = cols, edge.col = "gr
172177

173178
## A simple ergm model
174179

175-
```{r ergm-mcmc1, message=TRUE, warning=FALSE}
176-
# Estimating the model
177-
ans <- ergm(
178-
samplk1 ~ edges + nodematch("group") + ttriad,
179-
control = control.ergm(seed = 112)
180-
)
180+
* Suppose we want to test wether homophily on \textit{group} (individuals of the same group tend to connect with each other) and transitive triads (the friend of my friend) are driving the structure: \pause
181181

182-
```
182+
```{r}
183+
summary(samplk1 ~ edges + nodematch("group") + ttriad)
184+
```
185+
186+
\pause
187+
188+
* To estimate this model we do:
189+
190+
```{r ergm-mcmc1, message=FALSE, warning=FALSE, cache=TRUE}
191+
ans <- ergm(
192+
samplk1 ~ edges + nodematch("group") + ttriad,
193+
control = control.ergm(seed = 112)
194+
)
195+
196+
```
183197
184198
----
185199
186-
```{r ergm1-summary}
200+
```{r ergm1-summary, echo=TRUE, cache=TRUE}
187201
summary(ans)
188202
```
189203

190-
The common way to continue is: adding/removing terms, checking convergence, and checking goodness-of-fit.
191-
192204
----
193205

194-
Now its time for small networks!
206+
Now its time for \LARGE small \Huge networks!\normalsize
207+
208+
---
209+
210+
\begin{figure}
211+
\includegraphics[height = \textheight]{fig/american-chopper-argument-ergmitos.png}
212+
\end{figure}
213+
214+
## ERGMs for Small Networks
215+
216+
- In the case of small networks (e.g. at most 6 nodes), the calculation of \color[HTML]{5726e7} \textbf{normalizing constant}\color{black}{} becomes computationally feasible.\pause
217+
218+
- This allows direct calculation of the likelihood, \textbf{avoiding the need for simulations} and allowing us to obtain Maximum Likelihood Estimates using \textit{standard} optimization techniques.\pause
219+
220+
- In addition, most of the time samples of small networks include multiple of them, e.g.: Families, Small teams (like our data), Ego-nets, etc.\pause
221+
222+
- This makes pooled ERGM estimates a natural way of modeling the data.\pause
223+
224+
- This and more can be found in the [\textbf{ergmito}](https://github.com/muriteams/ergmito) R package \href{https://github.com/muriteams/ergmito}{(\includegraphics[width=.025\linewidth]{fig/github.png}/muriteams/ergmito)}
225+
226+
---
227+
228+
Sidetrack...
229+
230+
\begin{minipage}[c]{1\linewidth}
231+
\large \textbf{ito, ita}: From the latin -\textit{\=ittus}. suffix in Spanish used to denote small or affection. e.g.:
232+
233+
\hspace{.5cm} \textit{¡Qué lindo ese perr\textcolor{USCCardinal}{\textbf{ito}}!} / \textit{What a beautiful little dog!}
234+
235+
\hspace{.5cm} \textit{¿Me darías una tac\textcolor{USCCardinal}{\textbf{ita}} de azúcar?} / \textit{Would you give me a small cup of sugar?}
236+
\normalsize
237+
\end{minipage}\pause
238+
239+
\alert{Special thanks to George Barnett who proposed the name during the 2018 NASN!}
195240

196241
## `ergmito` example
197242

@@ -231,49 +276,59 @@ fivenets[[1]]
231276

232277
## `ergmito` example (cont'd)
233278

234-
The same as you would do with the `ergm` package:
279+
The same as you would do with the `ergm` package:\linebreak[4]
235280

236281
```{r fit-fivenets, cache=TRUE}
237-
(model1 <- ergmito(fivenets ~ edges + nodematch("female")))
238-
```
239-
240-
```{r fit-fivenets-print, results='asis', echo=FALSE, cache=TRUE}
241-
texreg::texreg(model1)
242-
# cat(gsub("#", "\\#", unclass(out), fixed=TRUE))
282+
model1 <- ergmito(fivenets ~ edges + nodematch("female"))
283+
summary(model1)
243284
```
244285

245286
---
246287

288+
Some features of this (\includegraphics[width=.1\linewidth]{lifecycle-experimental-orange.pdf}) R package
247289

248-
```{r gof-fivenets, cache=TRUE}
249-
(gof1 <- gof_ergmito(model1))
250-
```
290+
\begincols
251291

292+
\begincol{.65\linewidth}
293+
\begin{itemize}
294+
\setlength\itemsep{.5cm}
295+
\item<2-> Built on top of \href{https://statnet.org}{\textbf{statnet}}'s \href{https://github.com/statnet/ergm}{\texttt{ergm}} R package.
252296

253-
---
297+
\item<3-> Allows estimating ERGMs for small networks (less than 7 and perhaps 6) via MLE.
254298

255-
```{r gof-fivenets-print, cache=TRUE, out.width=".7\\linewidth", fig.align='center', width=8, height=6}
256-
plot(gof1)
257-
```
299+
\item<4-> Implements pooled ERGM models.
300+
301+
\item<5-> Includes a simulation function for efficiently drawing samples of small networks, and by \textbf{efficiently} we mean \textbf{fast}.
302+
\end{itemize}
303+
304+
\endcol
305+
306+
\begincol{.3\linewidth}
258307

308+
\includegraphics{fig/logo.png}
259309

310+
\endcol
311+
312+
\endcols
313+
314+
\uncover<6->{And much more!}
315+
316+
---
260317

261318
## Thanks!
262319

263320
\begin{centering}
264-
\includegraphics[width = .1\linewidth]{usc.pdf}
321+
\includegraphics[width = .4\linewidth]{fig/the-end.jpg}
265322

266323
\large \textbf{\textcolor{USCCardinal}{George G. Vega Yon}}
267324

268-
\normalsize Let's chat!
269325

270326
\href{mailto:vegayon@usc.edu}{vegayon@usc.edu}
271327

272328
\href{https://ggvy.cl}{https://ggvy.cl}
273329

274-
\includegraphics[width=.02\linewidth]{github.png}\href{https://github.com/gvegayon}{@gvegayon}
275-
276-
\includegraphics[width=.02\linewidth]{twitter.png}\href{https://twitter.com/gvegayon}{@gvegayon}
330+
\includegraphics[width=.02\linewidth]{github.png}\href{https://github.com/gvegayon}{gvegayon}
331+
\includegraphics[width=.02\linewidth]{twitter.png}\href{https://twitter.com/gvegayon}{gvegayon}
277332

278333
\end{centering}
279334

slides.pdf

1.34 MB
Binary file not shown.

0 commit comments

Comments
 (0)