Title: | Univariate and Multivariate Tests for Multimodal and Other Networks |
---|---|
Description: | A set of tools for testing networks. It includes functions for univariate and multivariate conditional uniform graph and quadratic assignment procedure testing, and network regression. The package is a complement to 'Multimodal Political Networks' (2021, ISBN:9781108985000), and includes various datasets used in the book. Built on the 'manynet' package, all functions operate with matrices, edge lists, and 'igraph', 'network', and 'tidygraph' objects, and on one-mode and two-mode (bipartite) networks. |
Authors: | James Hollway [cre, aut, ctb] (IHEID, <https://orcid.org/0000-0002-8361-9647>), Henrique Sposito [ctb] (IHEID, <https://orcid.org/0000-0003-3420-6085>), Jael Tan [ctb] (IHEID, <https://orcid.org/0000-0002-6234-9764>), Bernhard Bieri [ctb] |
Maintainer: | James Hollway <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.4.5 |
Built: | 2025-01-17 06:55:20 UTC |
Source: | https://github.com/stocnet/migraph |
A multimodal network with three levels representing ties between individuals, civic organisations in Bristol, and major protest and civic events that occurred between 1990 and 2000. The data contains individuals' affiliations to civic organizations in Bristol, the participation of these individuals in major protest and civic events between 1990-2002, and the involvement of the civic organizations in these events.
data(mpn_bristol)
data(mpn_bristol)
#> # Bristol protest event network #> # A labelled, two-mode network of 150 individuals and 1496 affiliation and #> participation ties #> # A tibble: 264 x 3 #> name type lvl #> <chr> <lgl> <dbl> #> 1 101 FALSE 1 #> 2 102 FALSE 1 #> 3 103 FALSE 1 #> 4 104 FALSE 1 #> 5 105 FALSE 1 #> 6 106 FALSE 1 #> # i 258 more rows #> # A tibble: 1,496 x 2 #> from to #> <int> <int> #> 1 36 151 #> 2 40 151 #> 3 73 151 #> 4 94 151 #> 5 138 151 #> 6 145 151 #> # i 1,490 more rows
Although represented as a two-mode network, it contains three levels:
150 Individuals, anonymised with numeric ID
97 Bristol civic organizations
17 Major protest and civic events in Bristol, 1990-2002
The network represents ties between level 1 (individuals) and level 2 (organisations), level 1 (individuals) and level 3 (events), as well as level 2 (organisations) and level 3 (events). The network is simple, undirected, and named. For a complete list of civic organisations and protest/civic events included in the data, please see Appendix 6.1 in Multimodal Political Networks (Knoke et al., 2021).
Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.
Diani, Mario, and Ivano Bison. 2004. “Organizations, Coalitions, and Movements.” Theory and Society 33(3–4):281–309. doi:10.1023/B:RYSO.0000038610.00045.07.
One-mode interstate trade relations and two-mode state membership in IGOs (COW)
data(mpn_cow_trade) data(mpn_cow_igo)
data(mpn_cow_trade) data(mpn_cow_igo)
#> # A labelled, weighted, directed network of 116 nodes and 11489 arcs #> # A tibble: 116 x 1 #> name #> <chr> #> 1 United States of America #> 2 Canada #> 3 Cuba #> 4 Dominican Republic #> 5 Jamaica #> 6 Trinidad and Tobago #> # i 110 more rows #> # A tibble: 11,489 x 3 #> from to weight #> <int> <int> <dbl> #> 1 1 2 180387 #> 2 1 3 587. #> 3 1 4 5511. #> 4 1 5 1896. #> 5 1 6 2188. #> 6 1 7 123677 #> # i 11,483 more rows
#> # A labelled, weighted, two-mode network of 152 nodes and 839 ties #> # A tibble: 152 x 3 #> name type polity2 #> <chr> <lgl> <dbl> #> 1 Afghanistan FALSE -7 #> 2 Albania FALSE 5 #> 3 Algeria FALSE -3 #> 4 Angola FALSE -6 #> 5 Argentina FALSE 8 #> 6 Australia FALSE 10 #> # i 146 more rows #> # A tibble: 839 x 3 #> from to weight #> <int> <int> <dbl> #> 1 1 113 1 #> 2 1 114 1 #> 3 1 115 0 #> 4 1 116 0 #> 5 1 117 1 #> 6 1 118 0 #> # i 833 more rows
mpn_cow_trade
is a one-mode matrix representing the trade relations between 116 states.
The data is derived from the Correlates of War Project (COW) Trade Dataset (v3.0),
which contains the annual dyadic and national trade figures for states (listed in COW)
between 1870 to 2009.
This network is based only on the dyadic trade figures in 2009 for the 116 states
listed in Appendix 7.1 in
Multimodal Political Networks
(Knoke et al., 2021).
The value in each cell of the matrix represents the value of exports
from the 116 row states to the 116 column states.
mpn_cow_igo
is a two-mode graph representing the membership of 116 states
in 40 intergovernmental organizations (IGOs).
The data is derived from the Correlates of War Project (COW)
Intergovernmental Organizations Dataset (v3.0),
which contains information about intergovernmental organizations from 1815-2014,
such as founding year and membership.
This network contains only a subset of the states and IGOs listed in COW,
with 116 states listed in Appendix 7.1 in Multimodal Political Networks
and 40 IGOs from Table 7.1 in Multimodal Political Networks
that also overlap with the COW dataset (Knoke et al., 2021).
The Correlates of War Project. 2012. Trade.
Barbieri, Katherine and Omar Keshk. 2012. Correlates of War Project Trade Data Set Codebook, Version 3.0.
The Correlates of War Project. 2019. Intergovernmental Organization v3.
Barbieri, Katherine, Omar M. G. Keshk, and Brian Pollins. 2009. “TRADING DATA: Evaluating our Assumptions and Coding Rules.” Conflict Management and Peace Science 26(5): 471-491. doi:10.1177/0738894209343887.
Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.
Pevehouse, Jon C.W., Timothy Nordstron, Roseanne W McManus, Anne Spencer Jamison. 2020. “Tracking Organizations in the World: The Correlates of War IGO Version 3.0 datasets”. Journal of Peace Research 57(3): 492-503. doi:10.1177/0022343319881175.
This data contains the full network of 35 members of the Mexican power elite. The undirected lines connecting pairs of men represent any formal, informal, or organizational relation between a dyad; for example, “common belonging (school, sports, business, political participation), or a common interest (political power)” (Mendieta et al. 1997: 37). Additional nodal attributes include their full name, place of birth, state, and region (1=North, 2=Centre, 3=South, original coding added by Frank Heber), as well as their year of entry into politics and whether they are civilian (0) or affiliated with the military (1). An additional variable "in_mpn" can be used to subset this network to a network of 11 core members of the 1990s Mexican power elite (Knoke 2017), three of which were successively elected presidents of Mexico: José López Portillo (1976-82), Miguel de la Madrid (1982-88), and Carlos Salinas de Gortari (1988-94, who was also the son of another core member, Raúl Salinas Lozano).
data(mpn_elite_mex)
data(mpn_elite_mex)
#> # Mexican power elite network #> # A labelled, undirected network of 35 elites and 117 common belonging or #> interest ties #> # A tibble: 35 x 8 #> name full_name entry_year military in_mpn PlaceOfBirth state region #> <chr> <chr> <dbl> <dbl> <dbl> <chr> <chr> <dbl> #> 1 Trevino Trevino, Jacint~ 1910 1 0 Guerrero Coah~ 1 #> 2 Madero Madero, Francis~ 1911 0 0 Parras de l~ Coah~ 1 #> 3 Carranza Carranza, Venus~ 1913 1 0 Cuatro Cien~ Coah~ 1 #> 4 Aguilar Aguilar, Candido 1918 1 0 Cordoba Vera~ 3 #> 5 Obregon Obregon, Alvaro 1920 1 0 Siquisiva, ~ Sono~ 1 #> 6 Calles Calles, Plutarc~ 1924 1 0 Guaymas Sono~ 1 #> # i 29 more rows #> # A tibble: 117 x 2 #> from to #> <int> <int> #> 1 2 3 #> 2 2 5 #> 3 2 6 #> 4 2 4 #> 5 1 2 #> 6 2 8 #> # i 111 more rows
Knoke, David. 1990. Political Networks.
Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.
mpn_elite_usa_advice
is a 2-mode network of persons serving as directors or trustees of think tanks.
Think tanks are “public-policy research analysis and engagement organizations
that generate policy-oriented research, analysis, and advice on domestic and international issues,
thereby enabling policymakers and the public to make informed decisions about public policy” (McGann 2016: 6).
The Power Elite Database (Domhoff 2016) includes information on the directors of 33 prominent think tanks in 2012.
Here we include only 14 directors who held three or more seats among 20 think tanks.
mpn_elite_usa_money
is based on 26 elites who sat on the boards of directors
for at least two of six economic policy making organizations (Domhoff 2016),
and also made campaign contributions to one or more of six candidates
running in the primary election contests for the 2008 Presidential nominations
of the Republican Party (Rudy Giuliani, John McCain, Mitt Romney)
or the Democratic Party (Hillary Clinton, Christopher Dodd, Barack Obama).
data(mpn_elite_usa_advice) data(mpn_elite_usa_money)
data(mpn_elite_usa_advice) data(mpn_elite_usa_money)
#> # A labelled, two-mode network of 34 nodes and 46 ties #> # A tibble: 34 x 2 #> type name #> <lgl> <chr> #> 1 FALSE Albright #> 2 FALSE Argyros #> 3 FALSE Armitage #> 4 FALSE Curry #> 5 FALSE Fukuyama #> 6 FALSE Gray #> # i 28 more rows #> # A tibble: 46 x 2 #> from to #> <int> <int> #> 1 1 17 #> 2 1 19 #> 3 1 21 #> 4 2 22 #> 5 2 23 #> 6 2 27 #> # i 40 more rows
#> # A labelled, two-mode network of 38 nodes and 103 ties #> # A tibble: 38 x 2 #> type name #> <lgl> <chr> #> 1 FALSE Adkerson #> 2 FALSE Akins #> 3 FALSE Banga #> 4 FALSE Boyce #> 5 FALSE Britt #> 6 FALSE Cannon #> # i 32 more rows #> # A tibble: 103 x 2 #> from to #> <int> <int> #> 1 1 27 #> 2 1 28 #> 3 1 34 #> 4 1 36 #> 5 2 28 #> 6 2 32 #> # i 97 more rows
Domhoff, G William. 2016. “Who Rules America? Power Elite Database.”
The Center for Responsive Politics. 2019. “OpenSecrets.” https://www.opensecrets.org.
Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.
6 two-mode matrices containing individuals' memberships to 14 different types of associations in three countries (Italy, Germany, and the UK) in 1990 and 2008. The Italy data has 658 respondents in 1990 and 540 in 2008. The Germany data has 1369 respondents in 1990 and 503 in 2008. The UK data has 738 respondents in 1990 and 664 in 2008.
data(mpn_IT_1990) data(mpn_IT_1990) data(mpn_IT_2008) data(mpn_DE_1990) data(mpn_DE_2008) data(mpn_UK_1990) data(mpn_UK_2008)
data(mpn_IT_1990) data(mpn_IT_1990) data(mpn_IT_2008) data(mpn_DE_1990) data(mpn_DE_2008) data(mpn_UK_1990) data(mpn_UK_2008)
tbl_graph
object based on an association matrix with 14 columns:
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
1 if individual associated
An object of class tbl_graph
(inherits from igraph
) of length 672.
An object of class tbl_graph
(inherits from igraph
) of length 554.
An object of class tbl_graph
(inherits from igraph
) of length 1383.
An object of class tbl_graph
(inherits from igraph
) of length 517.
An object of class tbl_graph
(inherits from igraph
) of length 752.
An object of class tbl_graph
(inherits from igraph
) of length 678.
Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.
EVS (2020). European Values Study Longitudinal Data File 1981-2008 (EVS 1981-2008). GESIS Data Archive, Cologne. ZA4804 Data file Version 3.1.0, doi:10.4232/1.13486.
Network of anonymised actors reacting to the Ryanair/Charleroi decision of the EU Commission in February 2004. The relationships mapped comprise an account of public records of interaction supplemented with the cognitive network of key informants. Examination of relevant communiques, public statements and a number of off-the-record interviews provides confidence that the network mapped closely approximated interactions between 29 January and 12 February 2004. The time point mapped is at the height of influence and interest intermediation played by actors in the AER, a comparatively obscure body representing the interests of a number of European regional bodies at the EU institutions.
data(mpn_ryanair)
data(mpn_ryanair)
#> # EU policy influence network #> # A labelled, weighted, directed network of 20 policy actors and 177 #> interaction arcs #> # A tibble: 20 x 1 #> name #> <chr> #> 1 1 AER #> 2 2 AER #> 3 5 AER/COR #> 4 7 RYANAIR #> 5 8 DG TRANSPORT #> 6 9 COR #> # i 14 more rows #> # A tibble: 177 x 3 #> from to weight #> <int> <int> <dbl> #> 1 1 2 1 #> 2 1 3 1 #> 3 1 4 1 #> 4 1 5 1 #> 5 1 6 1 #> 6 1 7 1 #> # i 171 more rows
Christopoulos, Dimitrios C. 2006. “Relational Attributes of Political Entrepreneurs: a Network Perspective.” Journal of European Public Policy 13(5): 757–78. doi:10.1080/13501760600808964.
Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.
These datasets list the U.S. Senators who served in the 112th Congress, which met from January 3, 2011 to January 3, 2013. Although the Senate has 100 seats, 103 persons served during this period due to two resignations and a death. However, the third replacement occurred only two days before the end and cast no votes on the bills investigated here. Hence, the number of Senators analyzed is 102.
CQ Almanac identified 25 key bills on which the Senate voted during the 112th Congress, and which Democratic and Republican Senators voting “yea” and “nay” on each proposal.
Lastly, we obtained data on campaign contributions made by 92 PACs from the Open Secrets Website. We recorded all contributions made during the 2008, 2010, and 2012 election campaigns to the 102 persons who were Senators in the 112th Congress. The vast majority of PAC contributions to a candidate during a campaign was for $10,000 (the legal maximum is $5,000 each for a primary and the general election). We aggregated the contributions across all three electoral cycles, then dichotomized the sums into no contribution (0) and any contribution (1).
data(mpn_senate_dem) data(mpn_senate_rep) data(mpn_senate_over)
data(mpn_senate_dem) data(mpn_senate_rep) data(mpn_senate_over)
#> # A labelled, weighted, two-mode network of 114 nodes and 2791 ties #> # A tibble: 114 x 2 #> type name #> <lgl> <chr> #> 1 FALSE Baucus #> 2 FALSE Begich #> 3 FALSE Bennet #> 4 FALSE Blumenthal #> 5 FALSE Boxer #> 6 FALSE BrownSh #> # i 108 more rows #> # A tibble: 2,791 x 3 #> from to weight #> <int> <int> <dbl> #> 1 1 52 1 #> 2 1 53 1 #> 3 1 54 1 #> 4 1 55 1 #> 5 1 56 1 #> 6 1 57 1 #> # i 2,785 more rows
#> # A labelled, weighted, two-mode network of 134 nodes and 3675 ties #> # A tibble: 134 x 2 #> type name #> <lgl> <chr> #> 1 FALSE Alexander #> 2 FALSE Ayotte #> 3 FALSE Barrasso #> 4 FALSE Baucus #> 5 FALSE Blunt #> 6 FALSE Boozman #> # i 128 more rows #> # A tibble: 3,675 x 3 #> from to weight #> <int> <int> <dbl> #> 1 1 64 1 #> 2 1 66 1 #> 3 1 67 1 #> 4 1 70 1 #> 5 1 71 1 #> 6 1 72 1 #> # i 3,669 more rows
#> # A labelled, weighted, two-mode network of 52 nodes and 614 ties #> # A tibble: 52 x 2 #> type name #> <lgl> <chr> #> 1 FALSE Baucus #> 2 FALSE Cardin #> 3 FALSE Carper #> 4 FALSE Casey #> 5 FALSE Collins #> 6 FALSE Feinstein #> # i 46 more rows #> # A tibble: 614 x 3 #> from to weight #> <int> <int> <dbl> #> 1 1 21 1 #> 2 1 22 1 #> 3 1 23 1 #> 4 1 24 1 #> 5 1 25 1 #> 6 1 26 1 #> # i 608 more rows
Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.
This function provides an implementation of the multiple regression quadratic assignment procedure (MRQAP) for both one-mode and two-mode network linear models. It offers several advantages:
it works with combined graph/network objects such as igraph and network objects by constructing the various dependent and independent matrices for the user.
it uses a more intuitive formula-based system for specifying the model, with several ways to specify how nodal attributes should be handled.
it can handle categorical variables (factors/characters) and interactions intuitively, naming the reference variable where appropriate.
it relies on {furrr}
for parallelising
and {progressr}
for reporting progress to the user,
which can be useful when many simulations are required.
results are {broom}
-compatible,
with tidy()
and glance()
reports to facilitate comparison
with results from different models.
Note that a t- or z-value is always used as the test statistic,
and properties of the dependent network
– modes, directedness, loops, etc –
will always be respected in permutations and analysis.
net_regression( formula, .data, method = c("qap", "qapy"), times = 1000, strategy = "sequential", verbose = FALSE )
net_regression( formula, .data, method = c("qap", "qapy"), times = 1000, strategy = "sequential", verbose = FALSE )
formula |
A formula describing the relationship being tested. Several additional terms are available to assist users investigate the effects they are interested in. These include:
|
.data |
A manynet-consistent network.
See e.g. |
method |
A method for establishing the null hypothesis. Note that "qap" uses Dekker et al's (2007) double semi-partialling technique, whereas "qapy" permutes only the $y$ variable. "qap" is the default. |
times |
Integer indicating number of simulations used for quantile estimation.
(Relevant to the null hypothesis test only -
the analysis itself is unaffected by this parameter.)
Note that, as for all Monte Carlo procedures, convergence is slower for more
extreme quantiles.
By default, |
strategy |
If |
verbose |
Whether the function should report on its progress.
By default FALSE.
See |
Krackhardt, David. 1988. “Predicting with Networks: Nonparametric Multiple Regression Analysis of Dyadic Data.” Social Networks 10(4):359–81. doi:10.1016/0378-8733(88)90004-4.
Dekker, David, David Krackhard, and Tom A. B. Snijders. 2007. “Sensitivity of MRQAP tests to collinearity and autocorrelation conditions.” Psychometrika 72(4): 563-581. doi:10.1007/s11336-007-9016-1.
Other models:
test_distributions
,
tests
networkers <- ison_networkers %>% to_subgraph(Discipline == "Sociology") model1 <- net_regression(weight ~ ego(Citations) + alter(Citations) + sim(Citations), networkers, times = 20) # Should be run many more `times` for publication-ready results tidy(model1) glance(model1) plot(model1)
networkers <- ison_networkers %>% to_subgraph(Discipline == "Sociology") model1 <- net_regression(weight ~ ego(Citations) + alter(Citations) + sim(Citations), networkers, times = 20) # Should be run many more `times` for publication-ready results tidy(model1) glance(model1) plot(model1)
These functions conduct tests of distributions:
test_distribution()
performs a two-sample Kolmogorov-Smirnov test on
whether two "diff_model" objects are drawn from the same distribution.
test_fit()
performs a chi-squared test on the squared Mahalanobis distance
between a diff_model and diff_models objects.
test_distribution(diff_model1, diff_model2) test_fit(diff_model, diff_models)
test_distribution(diff_model1, diff_model2) test_fit(diff_model, diff_models)
diff_model1 , diff_model2
|
diff_model objects |
diff_model |
A diff_model object is returned by
|
diff_models |
A diff_models object is returned by
|
test_gof()
takes a single diff_model object,
which may be a single empirical or simulated diffusion,
and a diff_models object containing many simulations.
Note that currently only the goodness of fit of the
It returns a tibble (compatible with broom::glance()
) that includes
the Mahalanobis distance statistic
between the observed and simulated distributions.
It also includes a p-value summarising a chi-squared test on this statistic,
listing also the degrees of freedom and number of observations.
If the p-value is less than the convention 0.05,
then one can argue that the first diffusion is not well captured by
Other models:
regression
,
tests
# test_distribution(play_diffusion(ison_networkers), # play_diffusion(ison_networkers, thresholds = 75)) # Playing a reasonably quick diffusion # x <- play_diffusion(generate_random(15), transmissibility = 0.7) # Playing a slower diffusion # y <- play_diffusions(generate_random(15), transmissibility = 0.1, times = 40) # plot(x) # plot(y) # test_fit(x, y)
# test_distribution(play_diffusion(ison_networkers), # play_diffusion(ison_networkers, thresholds = 75)) # Playing a reasonably quick diffusion # x <- play_diffusion(generate_random(15), transmissibility = 0.7) # Playing a slower diffusion # y <- play_diffusions(generate_random(15), transmissibility = 0.1, times = 40) # plot(x) # plot(y) # test_fit(x, y)
These functions conduct tests of any network-level statistic:
test_random()
performs a conditional uniform graph (CUG) test
of a measure against a distribution of measures on random networks
of the same dimensions.
test_permutation()
performs a quadratic assignment procedure (QAP) test
of a measure against a distribution of measures on permutations
of the original network.
test_random( .data, FUN, ..., times = 1000, strategy = "sequential", verbose = FALSE ) test_configuration( .data, FUN, ..., times = 1000, strategy = "sequential", verbose = FALSE ) test_permutation( .data, FUN, ..., times = 1000, strategy = "sequential", verbose = FALSE )
test_random( .data, FUN, ..., times = 1000, strategy = "sequential", verbose = FALSE ) test_configuration( .data, FUN, ..., times = 1000, strategy = "sequential", verbose = FALSE ) test_permutation( .data, FUN, ..., times = 1000, strategy = "sequential", verbose = FALSE )
.data |
A manynet-consistent network.
See e.g. |
FUN |
A graph-level statistic function to test. |
... |
Additional arguments to be passed on to FUN, e.g. the name of the attribute. |
times |
Integer indicating number of simulations used for quantile estimation.
(Relevant to the null hypothesis test only -
the analysis itself is unaffected by this parameter.)
Note that, as for all Monte Carlo procedures, convergence is slower for more
extreme quantiles.
By default, |
strategy |
If |
verbose |
Whether the function should report on its progress.
By default FALSE.
See |
Other models:
regression
,
test_distributions
marvel_friends <- to_unsigned(ison_marvel_relationships) marvel_friends <- to_giant(marvel_friends) %>% to_subgraph(PowerOrigin == "Human") # (cugtest <- test_random(marvel_friends, manynet::net_heterophily, attribute = "Attractive", # times = 200)) # plot(cugtest) # (qaptest <- test_permutation(marvel_friends, # manynet::net_heterophily, attribute = "Attractive", # times = 200)) # plot(qaptest)
marvel_friends <- to_unsigned(ison_marvel_relationships) marvel_friends <- to_giant(marvel_friends) %>% to_subgraph(PowerOrigin == "Human") # (cugtest <- test_random(marvel_friends, manynet::net_heterophily, attribute = "Attractive", # times = 200)) # plot(cugtest) # (qaptest <- test_permutation(marvel_friends, # manynet::net_heterophily, attribute = "Attractive", # times = 200)) # plot(qaptest)