## Testing for Externalities in Network Formation Using Simulation

August 2, 2019

Bryan S. Graham and Andrin Pelican 1 †

Initial Draft: June 2019, This Draft: July 2019

## Abstract

We discuss a simplified version of the testing problem considered by Pelican &amp; Graham (2019): testing for interdependencies in preferences over links among N (possibly heterogeneous) agents in a network. We describe an exact test which conditions on a sufficient statistic for the nuisance parameter characterizing any agent-level heterogeneity. Employing an algorithm due to Blitzstein &amp; Diaconis (2011), we show how to simulate the null distribution of the test statistic in order to estimate critical values and/or p-values. We illustrate our methods using the Nyakatoke risk-sharing network. We find that the transitivity of the Nyakatoke network far exceeds what can be explained by degree heterogeneity across households alone.

## JEL Classification:

Keywords: Networks, Strategic Interaction, Testing, β Model, Importance Sampling

1 Department of Economics, University of California -Berkeley, 530 Evans Hall #3380, Berkeley, CA 94720-3880 and National Bureau of Economic Research, e-mail: bgraham@econ.berkeley.edu, web: http://bryangraham.github.io/econometrics/ .

† Department of Economics, School of Economics and Political Science, University of St. Gallen, e-mail: andrin.pelican@student.unisg.ch.

We thank Aureo de Paula and participants in the Mannheim/Bonn summer school on social networks for useful feedback. All the usual disclaimers apply. Financial support from NSF grant SES #1851647 is gratefully acknowledged.

De Weerdt (2004) studies the formation of risk-sharing links among N = 119 households located in the Tanzanian village of Nyakatoke. Let ˆ ( P ) and ˆ ( P ) , respectively, equal the fraction of all ( N 3 ) triads which take the triangle and two-star configuration. De Weerdt (2004) finds that the transitivity of the Nyakatoke risk-sharing network

$$\hat { T } \mathbf I = \frac { 3 \hat { P } \left ( \bigtriangleup \right ) } { 3 \hat { P } \left ( \bigtriangleup \right ) + \hat { P } \left ( \bigtriangleup \right ) } = 0. 1 8 8 4$$

is almost three times its density ( ˆ ( P ) = 0 0698 . ). There are several, not necessarily mutually exclusive, explanations for the clustering present in Nyakatoke. First, it may reflect the increased value of a risk-sharing relationship between two households when 'supported' by a third household (Jackson et al., 2012). Households i and j may value a risk sharing link with each other more if they are both additionally linked to household k . Household k may then serve as a monitor, arbiter and referee for households i and j 's relationship (increasing its value). Second, clustering may simply be an artifact of degree heterogeneity, whereby high degree households link more frequently with one-another and hence form triangles ( ) incidentally. Third, clustering may also stem from homophilous sorting on kinship, ethnicity, religion and so on (McPherson et al., 2001).

In this chapter we outline a method of randomization inference, in the spirit of Fisher (1935), that can be used to 'test' for externalities, or interdependencies, in link formation. 2 Externalities arise when the utility two agents generate when forming a link varies with the presence or absence of edges elsewhere in the network. Attaching greater utility to 'supported' links is one such interdependency. Externalities typically imply that an efficient network will not form when link formation is negotiated bilaterally (e.g., Bloch &amp; Jackson, 2007). Consider household i , who is linked to k , an incidental consequence of i additionally linking to j , is that she will then be able to 'support' any link between j and k . When evaluating whether to form a link with j , i may not internalize this additional, non-bilateral, benefit; consequently, there may be too few risk-sharing links in Nyakatoke.

The scientific and policy implications of externalities are considerable (cf., Graham, 2016). In the presence of interdependencies small re-wirings of a network may induce a cascade of link revisions, alternating network structure, as well as agents' utility, substantially. In the absence of interdependencies links form bilaterally and re-wirings will not induce additional changes in network structure.

Testing for externalities in network formation is not straightforward; particularly if the null

2 We place 'test' in quotes to emphasize that while, as in other examples of randomization inference, the null hypothesis is explicitly formulated, rejection may arise for a variety of reasons. See Cox (2006, Chapter 3) for additional examples and discussion.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-3346194e-a7e5-40fd-889a-67ab6368f057.jpg)

Figure 1: Nyakatoke risk-sharing network

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-183c61d2-209a-4c19-a256-b4281c10c43e.jpg)

Wealth

&lt;

150,000 TSh

300,000 TSh

≤

Wealth

&lt;

600,000 TSh

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-b34ba50d-c4a7-4454-ab3d-b7670e02b776.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-89a48cb3-af73-4905-a8fe-ce04118d72de.jpg)

150,000 TSh

≤

Wealth

&lt;

300,000 TSh

Wealth

≥

600,000 TSh

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-e43d9d23-7cbf-4e5a-b7b1-d6303cb9a99d.jpg)

Notes: Nodes/Households are colored according to total land and livestock wealth in Tanzanian Shillings (calculated as described by Comola &amp; Fafchamps (2014)). Node sizes are proportional to degree.

Source: De Weerdt (2004) and authors' calculations. Raw data available at https://www.uantwerpen.be/en/staff/joachim-deweerdt/ (Accessed January 2017).

model allows for rich forms of agent-level heterogeneity. Allowing for heterogeneity under the null is essential, after all, such heterogeneity provides an alternative explanation for the type of link clustering which arises in the presence of externalities.

The approach outlined here draws upon Pelican &amp; Graham (2019). Our goal here, however, is primarily pedagogical; to introduce some key ideas and methods likely to be of interest to empirical researchers interested in networks. Relative to what is presented here, Pelican &amp; Graham (2019) additionally consider (i) directed as well as undirected networks, (ii) null models which allow for both degree heterogeneity and homophily, (iii) models with and without transfers, (iv) constructing test statistics to maximize power in certain directions and (v) novel Markov Chain Monte Carlo (MCMC) methods of simulating the null distribution of the test statistic.

While the presentation in this chapter is more basic, the upshot is that the method outlined here can be implemented by combining familiar heuristics (e.g., Milo et al., 2002) with a little game theory and the adjacency matrix simulation algorithm of Blitzstein &amp; Diaconis (2011).

We begin by outlining a simple network formation game with transfers in the spirit of Bloch &amp; Jackson (2007). We then formally describe our test. Next we discuss how to simulate the null distribution of our test statistic using an algorithm due to Blitzstein &amp; Diaconis (2011); we also briefly discuss other applications of this algorithm as well as alternatives to it. We close with an illustration based upon the Nyakatoke network.

In what follows we let D be the adjacency matrix associated with a simple graph G ( V E , ) defined on N = |V| vertices or agents. The set V = { 1 , . . . , N } includes all agents in the network and E ⊆ V × V equals the set of undirected edges or links among them. The set of all N × N undirected adjacency matrices is denoted by D N .

## A strategic network formation game with transfers

In this section we outline a simple model of strategic network formation where agents may make (bilateral) transfers to one another. Let ν i : D N → R be a utility function for agent i , which maps adjacency matrices - equivalently networks - into utils. The marginal utility for agent i associated with (possible) edge ( i, j ) is

$$M U _ { i j } \left ( \mathbf D \right ) = \begin{cases} \nu _ { i } \left ( \mathbf D \right ) - \nu _ { i } \left ( \mathbf D - i j \right ) & \text{if} \, D _ { i j } = 1 \\ \nu _ { i } \left ( \mathbf D + i j \right ) - \nu _ { i } \left ( \mathbf D \right ) & \text{if} \, D _ { i j } = 0 \end{cases}$$

where D -ij is the adjacency matrix associated with the network obtained after deleting edge ( i, j ) and D + ij the one obtained via link addition.

From Bloch &amp; Jackson (2006), a network is pairwise stable with transfers if the following condition holds.

Definition 1. ( Pairwise stability with Transfers) The network G ( V E , ) is pairwise stable with transfers if

- (i) ∀ ( i, j ) ∈ E ( G , MU ) ij ( D ) + MU ji ( D ) ≥ 0
- (ii) ∀ ( i, j ) / ∈ E ( G , MU ) ij ( D ) + MU ji ( D ) &lt; 0

Definition 1 states that the marginal utility of all links actually present in a pairwise stable network is (weakly) positive, while that associated with links not present is negative. The definition presumes utility is transferable, since it only requires that the sum of utility to i and j associated with edge ( i, j ) is positive. When the sum of the two marginal utilities is positive, there exists a within-dyad transfer such that both agents benefit. Note also that the definition is pairwise: the benefit of a link is evaluated conditional on the remaining network structure. It is possible, for example, that a coalition of players could increase their utility by jointly forming a set of links and making transfers to one another. Imposing more sophisticated play of this type would result in a refinement relative to the set of network configurations which satisfy Definition 1 (cf., Jackson, 2008).

In this chapter we will specialize to utility functions of the form

$$\nu _ { i } \left ( \mathbf d, \mathbf U ; \gamma _ { 0 }, \delta _ { 0 } \right ) = \sum _ { j } d _ { i j } \left [ A _ { i } + B _ { j } + \gamma _ { 0 } s _ { i j } \left ( \mathbf d \right ) - U _ { i j } \right ]$$

with U = [ U ij ] . Here A i and B j capture agent-level degree heterogeneity (cf., Graham, 2017). If A i is high, then the baseline utility associated with any link is high for agent i ( i is an 'extrovert'). If B j is high, then j is a particularly attractive partner for all other agents ( j is 'popular'). We leave the joint distribution of A = [ A i ] and B = [ B i ] unrestricted in what follows.

The s ij ( d ) term is associated with externalities in link formation. We require that s ij ( d ) = s ij ( d -ij ) = s ij ( d + ij ) ; additional restrictions might be needed to ensure the existence of a network that is pairwise stable with transfers and/or a test statistic with a non-degenerate null distribution.

Instead of formulating additional high-level conditions on s ij ( d ) , in what follows we empha-

size, and develop results for, two specific examples. In the first s ij ( d ) equals

$$s _ { i j } \left ( \mathbf d \right ) = \sum _ { k } d _ { j k },$$

which implies that agents receive more utility from links with popular (or high degree) agents. The second example specifies s ij ( d ) as

$$s _ { i j } \left ( \mathbf d \right ) & = \sum _ { k } d _ { i k } d _ { j k }, \\ \text{receive more utility from linking when they share other links in}$$

which implies that dyads receive more utility from linking when they share other links in common. This is a transitivity effect.

When the utility function is of the form given in (3) the marginal utility agent i gets from a link with j is

$$M U _ { i j } \left ( \mathbf d, \mathbf U ; \gamma _ { 0 }, \delta _ { 0 } \right ) = A _ { i } + B _ { j } + \gamma _ { 0 } s _ { i j } \left ( \mathbf d \right ) - U _ { i j }.$$

Pairwise stability then implies that, conditional on the realizations of A B U , , and the value of externality parameter γ 0 , the observed network must satisfy, for i = 1 , . . . , N -1 and j = i +1 , . . . , N

$$D _ { i j } = \mathbf 1 \left ( \tilde { A } _ { i } + \tilde { A } _ { j } + \gamma _ { 0 } \tilde { s } _ { i j } \left ( \mathbf d \right ) \geq \tilde { U } _ { i j } \right ) \\ B _ { i }, \, \tilde { s } _ { i i } \left ( \mathbf d \right ) = s _ { i i } \left ( \mathbf d \right ) + s _ { i i } \left ( \mathbf d \right ) \text{ and } \tilde { U } _ { i i } = U _ { i i } + U _ { i i }.$$

with ˜ A i = A i + B i , ˜ s ij ( d ) = s ij ( d ) + s ji ( d ) and ˜ U ij = U ij + U ji .

Equation (6) defines a system of ( N 2 ) = 1 2 N N ( -1) nonlinear simultaneous equations. Any solution to this system - and there will typically be multiple ones - constitutes a pairwise stable (with transfers) network. To make this observation a bit more explicit, similar to Miyauchi (2016), consider the mapping ϕ ( D ) : D N → I ( N 2 ) :

$$\varphi ( \mathbf d ) \equiv \left [ \begin{array} { c } 1 \left ( \tilde { A } _ { 1 } + \tilde { A } _ { 2 } + \gamma _ { 0 } \tilde { s } _ { 1 2 } \left ( \mathbf d \right ) \geq U _ { 1 2 } \right ) \\ 1 \left ( \tilde { A } _ { 1 } + \tilde { A } _ { 3 } + \gamma _ { 0 } \tilde { s } _ { 1 3 } \left ( \mathbf d \right ) \geq U _ { 1 3 } \right ) \\ \vdots \\ 1 \left ( \tilde { A } _ { N - 1 } + \tilde { A } _ { N } + \gamma _ { 0 } \tilde { s } _ { N - 1 N } \left ( \mathbf d \right ) \geq U _ { N - 1 N } \right ) \end{array} \right ].$$

Under the maintained assumption that the observed network satisfies Definition 1, the observed adjacency matrix corresponds to the fixed point

$$D = \text{vch} ^ { - 1 } \left [ \varphi \left ( D \right ) \right ].$$

Here vech( ) · vectorizes the ( N 2 ) elements in the lower triangle of an N × N matrix and we define its inverse operator as creating a symmetric matrix with a zero diagonal. In addition to the observed network there may be other d ∈ D N such that d = vech -1 [ ϕ ( d )] . The fixed point representation is useful for showing equilibrium existence as well as for characterization (e.g., using Tarski's (1955) fixed point theorem).

For the two types of network formation externalities we consider, specified in equations (4) and (5) above, the ϕ ( d ) mapping is weakly increasing in d for γ 0 ≥ 0 . This allows for the application of Tarski's (1955) theorem; ensuring existence of at least one pairwise stable equilibrium.

## Test formulation

Our goal is to assess the null hypothesis that γ 0 = 0 relative to the alternative that γ 0 &gt; 0 . The extension of what follows to two-sided tests is straightforward. A feature our testing problem is the presence of a high-dimensional nuisance parameter in the form of the N degree heterogeneity terms, ˜ A = [ ˜ A i ] . Since the value of these terms may range freely over the null, our null hypothesis is a composite one.

The composite nature of the null hypothesis raises concerns about size control. Ideally our test will have good size properties regardless of the particular value of ˜ A . Assume, for example, that the distribution of the { ˜ A i } N i =1 is right-skewed. In this case we will likely observe high levels of clustering among high ˜ A i agents. Measured transitivity in the network might be substantial even in the absence of any structural preference for transitive relationships. We want to avoid excessive rejection of our null hypothesis in such settings; we do so by varying the critical value used for rejection with the magnitude of a sufficient statistics for the { ˜ A i } N i =1 .

A simple example helps to fix ideas. Under the null we have, for i = 1 , . . . , N -1 and j = i +1 , . . . , N ,

$$\Pr \left ( D _ { i j } = 1 \right ) = \frac { \exp \left ( \tilde { A } _ { i } + \tilde { A } _ { j } \right ) } { 1 + \exp \left ( \tilde { A } _ { i } + \tilde { A } _ { j } \right ) }, \\ \intertext { s to the $\beta$-model of network formation (e.g., Chatterjee et al., 2011). \, As }$$

which corresponds to the β -model of network formation (e.g., Chatterjee et al., 2011). Assume that ˜ A i ∈ { -∞ , 1 2 ln ( ρ 1 -ρ )} with ˜ A i = -∞ with probability 1 -π . In this simple model two 'high' ˜ A i agents link with probability ρ , while low-to-low and low-to-high links never form. Some simple calculations give an overall density for this network of π ρ 2 , and a (population) transitivity index of ρ . For π small and or ρ large, transitivity in this network

may exceed density substantially even though there is no structural taste for transitive links among agents. Here the transitivity is entirely generated by high degree agents linking with one another with greater frequency and, only incidentally, forming triangles in the process. A simple comparison of density and transitivity in this case is uninformative.

Motivated in part by this inferential challenge, as well as to exploit classic results on testing in exponential families (e.g., Lehmann &amp; Romano, 2005, Chapter 4), it will be convenient in what follows to assume that ˜ U ij ∼ Logistic (0 , 1) . Next let A denoting a subset of the N dimensional Euclidean space in which ˜ A is, a priori, known to lie, and

$$\Theta _ { 0 } = \left \{ \left ( \gamma, \tilde { \mathbf A } ^ { \prime } \right ) \, \colon \, \gamma = 0, \tilde { \mathbf A } \in \mathbb { A } \right \}.$$

Our null hypothesis is

$$H _ { 0 } \ \colon \, \theta \in \Theta _ { 0 }$$

since ˜ A may range freely over A ⊂ R N under the null of no externalities in link formation ( γ 0 = 0 ). 3 With a little manipulation we can show that, under (9), the probability of the event D = d takes the exponential family form

$$P _ { 0 } \left ( \mathbf d ; \tilde { \mathbf A } \right ) = c \left ( \tilde { \mathbf A } \right ) \exp \left ( \mathbf d _ { + } ^ { \prime } \tilde { \mathbf A } \right ) \\ \mathbb { \dots \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb{ \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb { \dots } \, \mathbb \dots$$

with d + = ( d 1+ , . . . , d N + ) equal to the degree sequence of the network.

Let D N, d + denote the set of all undirected N × N adjacency matrices with degree counts also equal to d + and ∣ ∣ D N, d + ∣ ∣ denote the size, or cardinality, of this set. Under H 0 the conditional likelihood of D = d given D + = d + is

$$P _ { 0 } \left ( \mathbf d | \mathbf D _ { + } = \mathbf d _ { + } \right ) = \frac { 1 } { \left | \mathbb { D } _ { N, \mathbf d _ { + } } \right | }. \\ \text{matities all networks with identical } d \tau$$

∣ ∣ Under the null of no externalities all networks with identical degree sequences are equally probable . This insight will form the basis of our test.

Let T ( d ) be some statistic of the adjacency matrix D = d , say its transitivity index. We work with a (test) critical function of the form

$$\phi ( \mathbf d ) = \begin{cases} 1 & T ( \mathbf d ) > c _ { \alpha } ( \mathbf d _ { + } ) \\ g _ { \alpha } ( \mathbf d _ { + } ) & T ( \mathbf d ) = c _ { \alpha } ( \mathbf d _ { + } ) \\ 0 & T ( \mathbf d ) < c _ { \alpha } ( \mathbf d _ { + } ) \end{cases}.$$

3 There is an additional (implicit) nuisance parameter associated with equilibrium selection since, under the alternative, there may be many pairwise stable network configurations. We can ignore this complication for our present purposes, but see Pelican &amp; Graham (2019) for additional discussion and details.

We will reject the null if our statistic exceeds some critical value, c α ( d + ) and accept it - or fail to reject it - if our statistic falls below this critical value. If our statistic exactly equals the critical value, then we reject with probability g α ( d + ) . The critical value c α ( d + ) , as well as the probability g α ( d + ) , are chosen to set the rejection probability of our test under the null equal to α (i.e., to control size). In order to find the appropriate values of c α ( d + ) and g α ( d + ) we need to know the distribution of T ( D ) under the null.

Conceptually this distribution is straightforward to characterize; particularly if we proceed conditional on the degree sequence observed in the network in hand. Under the null all possible adjacency matrices with degree sequence d + are equally probable. The null distribution of T ( D ) therefore equals its distribution across all these matrices. By enumerating all the elements of D N, d + and calculating T ( d ) for each one, we could directly - and exactly - compute this distribution. In practice this is not (generally) computationally feasible. Even for networks that include as few as 10 agents, the set D N, d + may have millions of elements (see, for example, Table 1 of Blitzstein &amp; Diaconis (2011)). Below we show how to approximate the null distribution of T ( D ) by simulation, leading to a practical method of finding critical values for testing.

If we could efficiently enumerate the elements of D N, d + we would find c α ( d + ) by solving

$$\Pr \left ( T \left ( \mathbf D \right ) \geq c _ { \alpha } \left ( \mathbf d _ { + } \right ) \right | \mathbf D \in \mathbb { D } _ { N, d _ { + } } \right ) = \frac { \sum _ { \mathbf D \in \mathbb { D } _ { N, d _ { + } } } 1 \left ( T \left ( \mathbf D \right ) \geq c _ { \alpha } \left ( \mathbf d _ { + } \right ) \right ) } { \left | \mathbb { D } _ { N, d _ { + } } \right | } = \alpha. \quad \left ( 1 0 \right ) \\ \text{If there is no } c _ { \alpha } \left ( \mathbf d _ { + } \right ) \text{for which } ( 1 0 ) \text{ exactly holds, then we would instead find the smallest}$$

∣ ∣ If there is no c α ( d + ) for which (10) exactly holds, then we would instead find the smallest c α ( d + ) such that Pr ( T ( D ) &gt; c α ( d + ) | D ∈ D Nd , + ) ≥ α and choose g α ( d + ) to ensure correct size.

Alternatively we might instead calculate the p-value:

$$\Pr \left ( T \left ( \mathbf D \right ) \geq T \left ( \mathbf d _ { + } \right ) \right | \mathbf D \in \mathbb { D } _ { \mathbf N, d _ { + } } \right ) = \frac { \sum _ { \mathbf D \in \mathbb { D } _ { \mathbf N, d _ { + } } } \mathbf 1 \left ( T \left ( \mathbf D \right ) \geq T \left ( \mathbf d _ { + } \right ) \right ) } { \left | \mathbb { D } _ { N, d _ { + } } \right | }. \quad \ \ ( 1 1 ) \\ \intertext { If this probability is very low, say less than 5 percent of all networks in } \mathbb { D } _ { \mathbf N, d _ { + } } \text{ have a}$$

∣ ∣ If this probability is very low, say less than 5 percent of all networks in D Nd , + have a transitivity index larger than the one observed in the network in hand, then we might conclude that our network is 'unusual' and, more precisely, that it is not a uniform random draw from D Nd , + (our null hypothesis).

Below we show how to approximate the probabilities to the left of the equalities in (10) and (11) by simulation.

## Similarity of the test

In our setting, a test φ ( D ) , will have size α if its null rejection probability (NRP) is less than or equal to α for all values of the nuisance parameter:

$$\sup _ { \theta \in \Theta _ { 0 } } \mathbb { E } _ { \theta } \left [ \phi \left ( \mathbf D \right ) \right ] = \sup _ { \tilde { \mathbf A } \in \mathbb { A } } \mathbb { E } _ { \theta } \left [ \phi \left ( \mathbf D \right ) \right ] = \alpha.$$

Since ˜ A is high dimensional, size control is non-trivial. This motivates, as we have done, proceeding conditionally on the degree sequence.

Let D + be the set of all graphical degree sequences (see below for a discussion of 'graphic' integer sequences). For each d + ∈ D + our approach is equivalent to forming a test with the property that, for all θ ∈ Θ 0 ,

$$\mathbb { E } _ { \theta } \left [ \phi \left ( \mathbf D \right ) \left | \mathbf D _ { + } = \mathbf d _ { + } \right ] = \alpha.$$

Such an approach ensures similarity of our test since, by iterated expectations

$$\mathbb { E } _ { \theta } \left [ \phi \left ( \mathbf D \right ) \right ] = \mathbb { E } _ { \theta } \left [ \mathbb { E } _ { \theta } \left [ \phi \left ( \mathbf D \right ) \right | \mathbf D _ { + } \right ] \right ] = \alpha$$

for any θ ∈ Θ 0 (cf., Ferguson, 1967). By proceeding conditionally we ensure the NRP is unaffected by the value of the degree heterogeneity distribution { ˜ A i } N i =1 . Similar tests have proved to be attractive in other settings with composite null hypotheses (cf., Moreira, 2009).

## Choosing the test statistic

Ideally the critical function is chosen to maximize the probability of correctly rejecting the null under particular alternatives of interest. It turns out that, because our network formation model is incomplete under the alternative (as we have been silent about equilibrium selection), constructing tests with good power is non-trivial. In Pelican &amp; Graham (2019) we show how to choose the critical function, or equivalently the statistic T ( d ) , to maximize power against particular (local) alternatives. The argument is involved, so here we confine ourselves to a more informal development.

An common approach to choosing a test statistic, familiar from other applications of randomization testing (e.g., Cox, 2006, Chapter 3), is to proceed heuristically. This suggests, for example, choosing T ( D ) to be the transitivity index, or the support measure of Jackson et al. (2012), if the researcher is interested in 'testing' for whether agents prefer transitive relationships.

$$\mathbb { C } \, B. \, Graham and A. \, Pelican, 2019$$

A variation on this approach, inspired by the more formal development in Pelican &amp; Graham (2019), is to set T ( D ) equal to

$$T \left ( \mathbf D \right ) = \sum _ { i < j } \left ( D _ { i j } - \hat { p } _ { i j } \right ) \tilde { s } _ { i j } \left ( \mathbf d \right )$$

with ˆ p ij = exp ( ˆ ˜ + ˆ A i ˜ A j ) 1+exp ( ˆ ˜ + ˆ A i ˜ A j ) and ˆ ˜ A = [ ˆ ˜ A i ] the maximum likelihood estimate (MLE) of ˜ A . 4 The intuition behind (13) is as follows: if it is positive, this implies that high values of the externality term, ˜ s ij ( d ) , are associated with links that have low estimated probability under the null (such that D ij -ˆ p ij is large). The conjunction of 'surprising' links with large values of ˜ s ij ( d ) is taken as evidence that γ 0 &gt; 0 .

Consider the transitivity example with ˜ s ij ( d ) = 2 ∑ k d ik d jk ; statistic (13), with some manipulation, can be shown to equal

$$T \left ( { \mathbf D } \right ) = 6 \left [ \sum _ { i < j < k } D _ { i j } D _ { i k } D _ { j k } - \sum _ { i < j < k } \frac { 1 } { 3 } \left ( \hat { p } _ { i j } D _ { i k } D _ { j k } + D _ { i j } \hat { p } _ { i k } D _ { j k } + D _ { i j } D _ { i k } \hat { p } _ { j k } \right ) \right ].$$

Statistic (14) is a measure of the difference between the actual number of triangles in the network and (a particular) expected triangle count computed under the null. To see this assume, as would be approximately true if the graph were an Erdös-Rényi one, that ˆ p ij = ˆ ( P ) for all i &lt; j . Recalling that ˆ ( P ) and ˆ ( P ) respectively equal the fraction of all ( N 3 ) triads which are triangles and two-stars, we would have

$$T \left ( \mathbf D \right ) = 2 \binom { N } { 3 } \left [ 3 \hat { P } \left ( \triangle \right ) - \left ( 3 \hat { P } \left ( \triangle \right ) + \hat { P } \left ( \triangle \right ) \right ) \hat { P } \left ( \neg \right ) \right ]. \\ \intertext { i n d a m e t h o d f o r a n o b a t r a n o n t h o n m o r a t o f t h o n t i n t r i n }$$

The term in [] equals the difference between the numerator of the transitivity index and its denominator times density. For an Erdös-Rényi graph this difference should be approximately zero. In the presence of degree heterogeneity, the second term to the right of the equality in (14) is a null-model-assisted count of the expected number of triangles in G . A rejection therefore occurs when many 'surprising' triangles are present.

Before describing how to simulate the null distribution of T ( D ) we briefly recap. We start by specifying a sharp null hypothesis. Consider the network in hand with adjacency matrix D = d and corresponding degree sequence D + = d + . Our null hypothesis is that the observed network coincides with a uniform random draw from D N, d + (i.e., the set of all networks with identical degree sequences). This null is a consequence of the form on the

4 Chatterjee et al. (2011) present a simple fixed point algorithm for computing this MLE (see also Graham (2017)).

transferable utility network formation game outlined earlier. The testing procedure is to compare a particular statistic of D = d , say T ( d ) , with its distribution across D N, d + . If the observed value of T ( d ) is unusually large we take this as evidence against our null.

Although we have motivated our test as one for strategic interactions or externalities, in actuality we are really assessing the adequacy of a particular null model of network formation - namely the β -model. Our test may detect many types of violations of this model, albeit with varying degrees of power. Consequently we need to be careful about how we interpret a rejection in practice. At the same time, by choosing the test statistic T ( D ) with some care, we hope to generate good power to detect the violation of interest - that γ 0 &gt; 0 - and hence conclude that externalities in link formation are likely present when we reject.

## Simulating undirected networks with fixed degree

This section describes an algorithm, introduced by Blitzstein &amp; Diaconis (2011), for sampling uniformly from the set D N, d + . Our notation and exposition tracks that of Blitzstein &amp; Diaconis (2011), albeit with less details. As noted previously, direct enumeration of all the elements of D N, d + is generally not feasible. We therefore require a method of sampling from D N, d + uniformly and also, at least implicitly, estimating its size. The goal is to replace, for example, the exact p-value (11) with the simulation estimate

$$\hat { \Pr } \left ( T \left ( \mathbf D \right ) \geq T \left ( \mathbf d \right ) \left | \mathbf D \in \mathbb { D } _ { \mathbf N, \mathbf d _ { + } } \right ) = \frac { 1 } { B } \sum _ { b = 1 } ^ { B } \mathbf 1 \left ( T \left ( \mathbf D _ { b } \right ) \geq T \left ( \mathbf d \right ) \right ), \\ \mathbf t \cdots \mathbf \Phi \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \,.$$

where D b is a uniform random draw from D N, d + and B denotes the number of independent simulation draws selected by the researcher.

Two complications arise. First, it is not straightforward to construct a random draw from D N, d + . Second, we must draw uniformly from this set. Fortunately the first challenge is solvable using ideas from the discrete math literature. Researchers in graph theory and discrete math have studied the construction of graphs with fixed degrees and, in particular, provided conditions for checking whether a particular degree sequence is graphical (e.g., Sierksma &amp; Hoogeveen, 1991). We say that d + is graphical if there is feasible undirected network with degree sequence d + . Not all integer sequences are graphical. The reader can verify, for example, that there is no feasible undirected network of three agents with degree sequence d + = (3 2 1) , , .

As for the second complication, although we can not easily/directly construct a uniform random draw from D N, d + , we can use importance sampling (e.g., Owen, 2013) to estimate

$$\mathbb { C } \, B. \, Graham and A. \, Pelican, 2019$$

expectations with respect to this distribution.

The basic idea and implementation is due to Blitzstein &amp; Diaconis (2011). A similar, and evidently independently derived, algorithm is presented in Del Genio et al. (2010). While computationally faster approaches are now available, we nevertheless present the method introduced by Blitzstein &amp; Diaconis (2011) for it pedagogical value and easy implementation. Their approach is adequate for small to medium sized problems. Readers interested in applying the methods outlined below to large sparse graphs might consult Rao et al. (1996), McDonald et al. (2007) or Zhang &amp; Chen (2013). Pelican &amp; Graham (2019) introduce a more complicated MCMC simulation algorithm that holds additional graph statistics constant (besides the degree sequence). They also provide references to the fairly extensive literature on adjacency matrix simulation.

While our presentation of the Blitzstein &amp; Diaconis (2011) algorithm is motivated by a particular formal testing problem, our view is that it is also useful for more informally finding 'unusual' or 'interesting' features of a given network. Are links more transitive than one would expect in networks with similar degree sequences? Is average path length exceptionally short? For this reason, the material presented below may also enter a researcher's workflow during the data summarization or exploratory analysis stage.

## The algorithm

A sequential network construction algorithm begins with a matrix of zeros and sequentially adds links to it until its rows and columns sum to the desired degree sequence. Unfortunately, unless the links are added appropriately, it is easy to get 'stuck' (in the sense that at a certain point in the process it becomes impossible to reach a graph with the desired degree and the researcher must restart the process). The paper by Snijders (1991) provides examples and discussion of this phenomena.

As an example consider the graphical degree sequence d + = (2 2 1 1) , , , . If we begin with an empty graph and add an edge between agents 3 and 4, we will go from the degree sequence (2 , 2 1 1) , , to a residual one of (2 , 2 0 0) , , . Unfortunately (2 , 2 0 0) , , is not graphical. Adding more edges requires introducing self-loops or a double-edge, neither of which is allowed.

Intuitively we can avoid this phenomenon by first connecting high degree agents. Havel (1955) and Hakimi (1962) showed that this idea works for any degree sequence

Theorem 1. (Havel-Hakimi) Let d i + &gt; 0 , if d + does not have at least d i + positive entries other than i it is not graphical. Assume this condition holds. Let ˜ d + be a degree sequence of length N -1 obtained by

- [i] deleting the i th entry of d + and
- [ii] subtracting 1 from each of the d i + highest elements in d + (aside from the i th one).
- d + is graphical if and only if ˜ d + is graphical. If d + is graphical, then it has a realization where agent i is connected to any of the d i + highest degree agents (other than i ).

Theorem 1 gives a verifiable condition for whether a degree sequence is graphical. Blitzstein &amp; Diaconis (2011) extended this condition so that we can check whether a degree sequence is graphical if one node is already connected to some other nodes. This modified condition serves as a tool in their importance sampling algorithm.

Theorem 1 is suggestive of a sequential approach to building an undirected network with degree sequence d + . The procedure begins with a target degree sequence d + . It starts by choosing a link partner for the lowest degree agent (with at least one link). It chooses a partner for this agent from among those with higher degree. A one is then subtracted from the lowest degree agent and her chosen partner's degrees. This procedure continues until the residual degree sequence (the sequence of links that remain to be chosen for each agent) is a vector of zeros.

To formally describe such an approach we require some additional notation. Let ( ⊕ i 1 ,...,i k d + ) be the vector obtained by adding a one to the i 1 , . . . , i k elements of d + :

$$( \oplus _ { i _ { 1 }, \dots, i _ { k } } \mathbf d _ { + } ) _ { j } = \begin{cases} \begin{array} { c c } d _ { j + } + 1 & \text{for $j\in\{i_{1},\dots,i_{k}\}$} \\ d _ { j + } & \text{otherwise} \end{array} \end{cases}$$

Let ( /circleminus i 1 ,...,i k d + ) be the vector obtained by subtracting one from the i 1 , . . . , i k elements of d + :

$$( \ominus _ { i _ { 1 }, \dots, i _ { k } } \mathbf d _ { + } ) _ { j } = \begin{cases} \begin{array} { c c } d _ { j + } - 1 & \text{for $j\in\{i_{1},\dots,i_{k}\}$} \\ d _ { j + } & \text{otherwise} \end{array} \end{cases}$$

Algorithm 1. (Blitzstein and Diaconis) A sequential algorithm for constructing a random graph with degree sequence d + = ( d 1+ , . . . , d N + ) ′ is

- 1. Let D be an empty adjacency matrix.
- 2. If d + = 0 terminate with output D
- 3. Choose the agent i with minimal positive degree d i + .

/negationslash

- 4. Construct a list of candidate partners J = { j = i : D ij = D ji = 0 and /circleminus i,j d + graphical } .
- 5. Pick a partner j ∈ J with probability proportional to its degree in d + .
- ©B. Graham and A. Pelican, 2019

Figure 2: Cubic graph with six agents

0

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-90698bdf-5a0c-4e57-8a4f-acd5a4153797.jpg)

Notes: Prism graph (a 3-regular graph) on six vertices. Sources: Authors' calculations.

- 6. Set D ij = D ji = 1 and update d + to /circleminus i,j d + .
- 7. Repeat steps 4 to 6 until the degree of agent i is zero.
- 8. Return to step 2.

The input for Algorithm 1 is the target degree sequence d + and the output is an undirected adjacency matrix D ∈ D Nd , + (i.e., with D ′ ι = d + ). 5

Consider the 3-regular (i.e., cubic graph) depicted in Figure 2. Each agent in this graph has exactly three links such that its degree sequence equals (3 , 3 3 3 3 3) , , , , . In turns out that there are two non-isomorphic cubic graphs on six vertices: the prism graph, shown in the figure, and the utility graph (or complete bipartite graph on two sets of three vertices). We can use Algorithm 1 to generate a random draw from the set of all graphs with a degree sequence of d + = (3 3 3 3 3 3) , , , , , .

As an example of a series of residual degree sequences (updated in Step 6 of the algorithm) associated with a random draw from D Nd , + , for N = 6 and d + = (3 3 3 3 3 3) , , , , , , consider:

$$\hat { \hat { \Lambda } }$$

$$( 3, 3, 3, 3, 3 ) & \rightarrow ( 2, 2, 3, 3, 3 ) \rightarrow ( 1, 2, 3, 3, 2, 3 ) \rightarrow ( 0, 2, 2, 3, 2, 3 ) \\ & \rightarrow ( 0, 1, 2, 3, 2, 2 ) \rightarrow ( 0, 0, 2, 2, 2, 2 ) \rightarrow ( 0, 0, 1, 2, 1, 2 ) \\ & \rightarrow ( 0, 0, 0, 2, 1, 1 ) \rightarrow ( 0, 0, 0, 1, 0, 1 ) \rightarrow ( 0, 0, 0, 0, 0 ) \,.$$

Labelling agents i = 0 1 , , . . . , 5 from left-to-right we can see that the first link is added between agents 0 and 1 (the 'active' node's residual degree is bold-faced above). This is illustrated in Figure 3, which begins with the labelled empty graph in the upper-left-hand

5 Here ι denotes a conformable column vector of ones.

corner and then sequentially adds links as we move from left-to-right and top-to-bottom.

Next a link is added between agents 0 and 4, and then between agents 0 and 2. Observe that the algorithm selected agent 0 as the lowest degree agent in the initial step and continues to connect this vertex with higher degree ones until all needed edges incident to it are present. 6

In the 8th iteration of the algorithm an edge is added between agents 3 and 4. If, instead, an edge was added between agents 4 and 5 at this point, the residual sequence degree sequence would have been updated to (0 , 0 0 2 0 0) , , , , , which is not graphic. Step 4 of the algorithm prevents the addition of edges which, if added, lead to non-graphic degree sequences. It is in this way that the algorithm avoids getting 'stuck'. Getting stuck was a problem with earlier approaches to binary matrix simulation, such as the method of Snijders (1991).

## Importance sampling

Algorithm 1 produces a random draw from D N, d + , however, it does not draw from this set uniformly. A key insight of Blitzstein &amp; Diaconis (2011) is that one can construct importance sampling weights to correct for non-uniformity of the draws from D N, d + .

Let Y N, d + denote the set of all possible sequences of links outputted by Algorithm 1 given input d + . Let D ( Y ) be the adjacency matrix induced by link sequence Y . Let Y and Y ′ be two different sequences produced by the algorithm. These sequences are equivalent if their 'end point' adjacency matrices coincide (i.e., if D ( Y ) = D ( Y ′ ) ). We can partition Y N, d + into a set of equivalence classes, the number of such classes coincides with the number of feasible networks with degree distribution d + (i.e., with the cardinality of D N, d + ).

6 In the event of ties for the lowest degree agent, the algorithm chooses the one with the lowest index.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-e3a3581a-2099-4b08-ac47-be79fce047c3.jpg)

Notes: Illustration of the construction of a random draw from D N, d + , for N = 6 and d + = (3 3 3 3 3 3) , , , , , , as generated according to Algorithm 1.

Sources: Authors' calculations.

Let c ( Y ) denote the number of possible link sequences produced by Algorithm 1 that produce Y 's end point adjacency matrix (i.e., the number of different ways in which Algorithm 1 can generate a given adjacency matrix). Let i 1 , i 2 , . . . , i M be the sequence of agents chosen in step 3 of Algorithm 1 in which Y is the output. Let a , . . . , a 1 m be the degree sequences of i 1 , . . . , i M at the time when each agent was first selected in step 3, then

$$c \left ( Y \right ) = \prod _ { k = 1 } ^ { M }$$

To see why (16) holds consider two equivalent link sequences Y and Y ′ . Because links are added to vertices by minimal degree (see Step 3 of Algorithm 1), the agent sequences i 1 , i 2 , . . . , i M coincide for Y and Y ′ . This, in turn, means that the exact same links , perhaps in a different order, are added at each 'stage' of the algorithm (i.e., when the algorithm iterates through steps 4 to 7 repeatedly for a given agent). The number of different ways to add agent i k 's links during such a 'stage' is simply a k ! and hence (16) follows.

The second component needed to construct importance weights is σ ( Y ) , the probability that Algorithm 1 produces link sequence Y . This probability is easy to compute. Each time the algorithm chooses a link in step 5 we simply record the probability with which it was chosen (i.e., the residual degree of the chosen agent divided by the sum of the residual degrees of all agents in the choice set). The product of all these probabilities equals σ ( Y ) .

With c ( Y ) and σ ( Y ) defined we can now show how to estimate expectations with respect to uniform draws from D N, d + . Let T ( D ) be some statistic of the adjacency matrix. Here for D is a draw from D N, d + constructed using Algorithm 1. Consider the p-value estimation problem discussed earlier:

$$\mathbb { E } \left [ \frac { \pi \left ( \mathcal { D$$

Here π ( D ) is the probability attached to the adjacency matrix D ∈ D N, d + in the target distribution over D N, d + . The ratio π ( D ( Y )) /c ( Y ) σ ( Y ) is called the likelihood ratio or the importance weight. We would like π ( D ) = 1 / D N, d + for all D ∈ D N, d + .

$$\begin{array} {$$

∣ ∣ ∣ ∣ Observe that E π [ T ( D ( Y ))] = E [ π ( D ( Y )) c Y ( ) σ Y ( ) T ( D ( Y )) ] ; setting π ( D ( Y )) = ∣ ∣ D N, d + ∣ ∣ -1 and T ( D ( Y )) = 1 to the constant statistic, then suggests an estimate of ∣ D N, d + ∣ equal to and hence a p-value estimate of

$$\hat { \rho } _ { T \text{G} } & = \left [ \$$

An attractive feature of (18) is that the importance weights need only be estimated up to a constant. This feature is useful when dealing with numerical overflow issues that can arise when ∣ D N, d + ∣ is too large to estimate.

∣ ∣ Algorithm (1) is appropriate for simulating undirected networks. Recently Kim et al. (2012) propose a method for simulating from directed networks with both fixed indegree and outdegree sequences. Their methods is based on an extension of Havel-Hakimi type results to digraphs due to Erdös et al. (2010). Pelican &amp; Graham (2019) introduce an MCMC algorithm for simulating digraphs satisfying various side constraints.

## Illustration using the Nyakatoke network

The transitivity index for the Nyakatoke network, at 0.1884, is almost three times its associated network density of 0.0698. Is this excess transitivity simply a product of degree heterogeneity alone? To assess this we used Algorithm 1 to take 5,000 draws from the set of adjacency matrices with N = 119 and degree sequences coinciding with the one observed in Nyakatoke (for reference the Nyakatoke degree distribution is plotted in Figure 4).

Figure 5 displays estimates of the distribution of two star and triangle counts, as well as the transitivity index (and 'optimal' transitivity statistic), with respect to the distribution of uniform draws from D N, d + ( N = 119 and d + coinciding with the one observed in Nyakatoke). Measured transitivity is Nyakatoke is extreme relative to this reference distribution. This suggests that clustering of links is, in fact, a special feature of the Nyakatoke network. It is also interesting to note that the distribution of transitivity in this reference distribution

Figure 4: Nyakatoke Degree Distribution

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-50682be9-3722-4553-8b47-673bf384d41e.jpg)

Notes: This figure plots the probability (vertical axis) that a random household in Nyakatoke has strictly more risk sharing links than listed on the horizontal axis.

Source: De Weerdt (2004) and authors' calculations. Raw data available at https://www.uantwerpen.be/en/staff/joachim-deweerdt/ (Accessed January 2017).

Notes: Histogram of two star counts, triangle counts and transitivity index values across 5,000 draws from D N, d + ( N = 119 and d + coinciding with the one observed in Nyakatoke). The final figure plots the distribution of the 'optimal' transitivity statistic given in Equation (13). Sources: De Weerdt (2004) and authors' calculations. Raw data available at https://www.uantwerpen.be/en/staff/joachim-deweerdt/ (Accessed January 2017).

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-9a69650d-48cc-4ec4-b0af-78ba5139e1d8.jpg)

Figure 5: Reference distribution of transitivity index for Nyakatoke network

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-2955d637-fb0c-423d-9e3e-c915ae2db299.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-72ad4406-074c-446c-8482-8f2d4151fb1f.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-3a732c05-9045-447e-b211-6a5b58616dfb.jpg)

is well to the right of 0.0698 (the density of all graphs in the reference distribution). The skewed degree distribution in Nyakatoke forces a certain amount of transitivity, since high degree nodes are more likely to link with one another. This highlights the value of a test which proceeds conditionally on the degree sequence.

Figure 6 displays estimates of the distribution of network diameter and average distance. Nyakatoke's diameter is not atypical across networks with the same degree sequence. However, average distance is significantly longer in Nyakatoke. One interpretation of this fact is that the Nyakatoke includes a distinct periphery of poorly connected/insured households.

## References

Blitzstein, J. &amp; Diaconis, P. (2011). A sequential importance sampling algorithm for generating random graphs with prescribed degrees. Internet Mathematics , 6(4), 489 - 522.

Bloch, F. &amp; Jackson, M. O. (2006). Definitions of equilibrium in network formation games. International Journal of Game Theory , 34(3), 305 - 318.

Bloch, F. &amp; Jackson, M. O. (2007). The formation of networks with transfers among players. Journal of Economic Theory , 113(1), 83 - 110.

Chatterjee, S., Diaconis, P., &amp; Sly, A. (2011). Random graphs with a given degree sequence. Annals of Applied Probability , 21(4), 1400 - 1435.

Figure 6: Reference distribution of network diameter and average distance for Nyakatoke network

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-02eb9cf9-58e8-48bb-aa11-7cd61eaaea22.jpg)

Notes: Histogram of values network diameter and average distance across 5,000 draws from D N, d + ( N = 119 and d + coinciding with the one observed in Nyakatoke).

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00099v1-figure-9a213109-9534-456f-890d-27256b5f09ec.jpg)

Sources: De Weerdt (2004) and authors' calculations. Raw data available at https://www.uantwerpen.be/en/staff/joachim-deweerdt/ (Accessed January 2017).

Comola, M. &amp; Fafchamps, M. (2014). Testing unilateral and bilateral link formation. Economic Journal , 124(579), 954 - 976.

Cox, D. R. (2006). Principles of Statistical Inference . Cambridge: Cambridge University Press.

De Weerdt, J. (2004). Insurance Against Poverty , chapter Risk-sharing and endogenous network formation, (pp. 197 - 216). Oxford University Press: Oxford.

Del Genio, C. I., Kim, H., Toroczkai, Z., &amp; Bassler, K. (2010). Efficient and exact sampling of simple graphs with given arbitrary degree sequence. Plos One , 5(4), e100012.

Erdös, P. L., Mikos, I., &amp; Toroczkai, Z. (2010). A simple havel-hakimi type algorithm to realize graphical degree sequences of directed graphs. Electronic Journal of Combinatorics , 17(1), R66.

Ferguson, T. S. (1967). Mathematical Statistics: A Decision Theoretic Approach . New York: Academic Press.

Fisher, R. A. (1935). The Design of Experiments . Edinburgh: Oliver and Boyd.

©B. Graham and A. Pelican, 2019

Graham, B. S. (2016). Homophily and transitivity in dynamic network formation . NBER Working Paper 22186, National Bureau of Economic Research.

Graham, B. S. (2017). An econometric model of network formation with degree heterogeneity. Econometrica , 85(4), 1033 - 1063.

- Hakimi, S. L. (1962). On realizability of a set of integers as degrees of the vertices of a linear graph. i. Journal of the Society for Industrial and Applied Mathematics , 10(3), 496 - 506.
- Havel, V. J. (1955). A remark on the existence of finite graph. Časopis Pro Pěstování Matematiky , 80, 477 - 480.
- Jackson, M. O. (2008). Social and Economic Networks . Princeton: Princeton University Press.
- Jackson, M. O., Rodriguez-Barraquer, T., &amp; Tan, X. (2012). Social capital and social quilts: network patterns of favor exchange. American Economic Review , 102(5), 1857-1897.

Kim, H., Del Genio, C. I., Bassler, K. E., &amp; Toroczkai, Z. (2012). Constructing and sampling directed graphs with given degree sequences. New Journal of Physics , 14, 023012.

- Lehmann, E. L. &amp; Romano, J. P. (2005). Testing Statistical Hypotheses . New York: Springer, 3rd edition.
- McDonald, J. W., Smith, P. W. F., &amp; Forster, J. J. (2007). Markov chain monte carlo exact inference for social networks. Social Networks , 29(1), 127 - 136.

McPherson, M., Smith-Lovin, L., &amp; Cook, J. M. (2001). Birds of a feather: homophily in social networks. Annual Review of Sociology , 27(1), 415 - 444.

- Milo, R., Shen-Orr, S., Itzkovitz, S., Kashtan, N., Chklovskii, D., &amp; Alon, U. (2002). Network motifs: simple building blocks of complex networks. Science , 298(5594), 824 - 827.
- Miyauchi, Y. (2016). Structural estimation of a pairwise stable network with nonnegative externality. Journal of Econometrics , 195(2), 224 - 235.

Moreira, M. J. (2009). Tests with correct size when instruments can be arbitrarily weak. Journal of Econometrics, 152(2), 131-140 , 152(2), 131 - 140.

Owen, A. B. (2013). Monte carlo theory, methods and examples. Book Manuscript.

Pelican, A. &amp; Graham, B. S. (2019). Testing for strategic interaction in social and economic network formation . Technical report, University of California - Berkeley.

- ©B. Graham and A. Pelican, 2019

Rao, A. R., Jana, R., &amp; Bandyopadhyay, S. (1996). A markov chain monte carlo method for generating random (0,1)-matrices with given marginals. Sankhya , 58(2), 225 - 242.

Sierksma, G. &amp; Hoogeveen, H. (1991). Seven criteria for integer sequences being graphic. Journal of Graph Theory , 15(2), 223 - 231.

- Snijders, T. A. B. (1991). Enumeration and simulation methods for 0-1 matrices with given marginals. Psychometrika , 56(3), 397 - 417.

Tarski, A. (1955). A lattice-theoretical fixpoint theorem and its applications. Pacific Journal of Mathematics , 5(2), 285 - 309.

Zhang, J. &amp; Chen, Y. (2013). Sampling for conditional inference on network data,. Journal of the American Statistical Association , 108(504), 1295 - 1307.
Bryan S. Graham Andrin Pelican
Testing for Externalities in Network Formation Using Simulation
We discuss a simplified version of the testing problem considered by Pelican
and Graham (2019): testing for interdependencies in preferences over links
among N (possibly heterogeneous) agents in a network. We describe an exact test
which conditions on a sufficient statistic for the nuisance parameter
characterizing any agent-level heterogeneity. Employing an algorithm due to
Blitzstein and Diaconis (2011), we show how to simulate the null distribution
of the test statistic in order to estimate critical values and/or p-values. We
illustrate our methods using the Nyakatoke risk-sharing network. We find that
the transitivity of the Nyakatoke network far exceeds what can be explained by
degree heterogeneity across households alone.