Package {migraph}


Title: Inferential Methods for Multimodal and Other Networks
Version: 1.7.0
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.
URL: https://stocnet.github.io/migraph/
BugReports: https://github.com/stocnet/migraph/issues
License: MIT + file LICENSE
Language: en-GB
Encoding: UTF-8
LazyData: true
Depends: R (≥ 4.1.0), manynet (≥ 2.3.1), autograph (≥ 1.2.2), netrics (≥ 0.4.0)
Imports: dplyr (≥ 1.1.0), ergm, future, furrr, generics, knitr, learnr, purrr
Suggests: rmarkdown, shiny, testthat (≥ 3.0.0)
Config/Needs/build: roxygen2, devtools
Config/Needs/check: covr, lintr, spelling
Config/Needs/website: pkgdown, learnr
Config/testthat/parallel: true
Config/testthat/edition: 3
Config/testthat/start-first: tutorials_migraph
Config/roxygen2/version: 8.1.0
NeedsCompilation: no
Packaged: 2026-08-30 06:14:29 UTC; hollway
Author: James Hollway ORCID iD [cre, aut, ctb] (IHEID), Henrique Sposito ORCID iD [ctb] (IHEID), Jael Tan ORCID iD [ctb] (IHEID), Bernhard Bieri ORCID iD [ctb]
Maintainer: James Hollway <james.hollway@graduateinstitute.ch>
Repository: CRAN
Date/Publication: 2026-08-30 06:40:02 UTC

migraph: Inferential Methods for Multimodal and Other Networks

Description

logo

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.

Author(s)

Maintainer: James Hollway james.hollway@graduateinstitute.ch (ORCID) (IHEID) [contributor]

Authors:

Other contributors:

See Also

Useful links:


Functions that have been renamed, superseded, or are no longer working

Description

[Deprecated] Generally these functions have been superseded or renamed. Upon using them, a message is provided directing the user to the new function. However, at this stage of package development, we generally clear older defunct functions at each minor release, and so you are strongly encouraged to use the new functions/names/syntax wherever possible and update your scripts accordingly.

Usage

test_gof(diff_model, diff_models)

network_reg(
  formula,
  .data,
  method = c("qap", "qapy"),
  times = 1000,
  strategy = "sequential",
  verbose = FALSE
)

Functions


Simulating multiple diffusion processes

Description

Simulating multiple diffusion processes

Usage

play_diffusions(
  .data,
  ...,
  times = 5,
  strategy = "sequential",
  verbose = FALSE
)

Arguments

.data

An object of a manynet-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

  • stocnet, from the {manynet} package

...

Other parameters inherited from manynet::play_diffusion().

times

Integer indicating number of simulations. By default times=5, but 1,000 - 10,000 simulations recommended for publication-ready results.

strategy

If {furrr} is installed, then multiple cores can be used to accelerate the simulations. By default "sequential", but if multiple cores available, then "multisession" or "multicore" may be useful. Generally this is useful only when times > 1000. See {furrr} for more.

verbose

Whether the function should report on its progress. By default FALSE. See {progressr} for more.

Examples

play_diffusions(mpn_elite_mex, times = 10)

Helper functions for measuring over splits of networks

Description

Usage

over_membership(
  .data,
  FUN,
  ...,
  membership,
  strategy = "sequential",
  verbose = FALSE
)

over_waves(
  .data,
  FUN,
  ...,
  attribute = "wave",
  strategy = "sequential",
  verbose = FALSE
)

over_time(
  .data,
  FUN,
  ...,
  attribute = "time",
  slice = NULL,
  strategy = "sequential",
  verbose = FALSE
)

Arguments

.data

A manynet-consistent network. See e.g. manynet::as_tidygraph() for more details.

FUN

A function to run over all splits.

...

Further arguments to be passed on to FUN.

membership

A categorical membership vector.

strategy

If {furrr} is installed, then multiple cores can be used to accelerate the function. By default "sequential", but if multiple cores available, then "multisession" or "multicore" may be useful. Generally this is useful only when times > 1000. See {furrr} for more.

verbose

Whether the function should report on its progress. By default FALSE. See {progressr} for more.

attribute

A string naming the attribute to be split upon.

slice

Optionally, a vector of specific slices. Otherwise all observed slices will be returned.


Multimodal (3) Bristol protest events, 1990-2002 (Diani and Bison 2004)

Description

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.

Usage

data(mpn_bristol)

Format

#> -- # Bristol protest event network ---------------------------------------------
#> # A labelled, undirected network of 264 individuals and 1496 affiliation and
#> participation ties
#> 
#> -- Nodes
#> # A tibble: 264 x 2
#>   label mode       
#>   <chr> <chr>      
#> 1 101   individuals
#> 2 102   individuals
#> 3 103   individuals
#> 4 104   individuals
#> 5 105   individuals
#> 6 106   individuals
#> # i 258 more rows
#> 
#> -- Ties
#> # 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
#> 

Details

Although represented as a two-mode network, it contains three levels:

1.

150 Individuals, anonymised with numeric ID

2.

97 Bristol civic organizations

3.

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).

Source

Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.

References

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.


Multilevel state trade and IGO membership network (COW)

Description

mpn_cow combines interstate trade and membership in intergovernmental organisations (IGOs) into a single multilevel network of 116 states and 40 IGOs. It holds two tie layers:

trade

directed, weighted ties among the states, in 2009

membership

undirected ties from states to the 40 IGOs

The mode node attribute separates the "states" from the "IGOs". The polity2 node attribute is carried over for the states, and the scope node attribute records whether an IGO is "global" or "regional". Seven are global: IOMig, OECD, OIC, OPEC, OSCE, UN, and WTO. Four states appear in the trade data but not in the IGO data: Bosnia and Herzegovina, Iceland, Lebanon, and Brunei. Their polity2 value is NA.

Usage

data(mpn_cow)

Format

#> -- # State trade and IGO membership network ------------------------------------
#> # A labelled, weighted, multilevel network of 116 states and 40 IGOs and 10730
#> trade arcs and 839 membership ties (9958 parallel)
#> 
#> -- Nodes
#> # A tibble: 156 x 4
#>   label                    mode   polity2 scope
#>   <chr>                    <chr>    <dbl> <chr>
#> 1 United States of America states      10 <NA> 
#> 2 Canada                   states      10 <NA> 
#> 3 Cuba                     states      -7 <NA> 
#> 4 Dominican Republic       states       8 <NA> 
#> 5 Jamaica                  states       9 <NA> 
#> 6 Trinidad and Tobago      states       9 <NA> 
#> # i 150 more rows
#> 
#> -- Missings
#> # A tibble: 759 x 4
#>    from    to weight layer
#>   <int> <int>  <dbl> <chr>
#> 1    31     1     NA trade
#> 2    31     2     NA trade
#> 3    31     3     NA trade
#> 4    41     3     NA trade
#> 5    59     3     NA trade
#> 6    64     3     NA trade
#> # i 753 more rows
#> 
#> -- Ties
#> # A tibble: 11,569 x 4
#>    from    to  weight layer
#>   <int> <int>   <dbl> <chr>
#> 1     2     1 228376  trade
#> 2     4     1   3421. trade
#> 3     5     1    501  trade
#> 4     6     1   5624. trade
#> 5     7     1 178335  trade
#> 6     8     1   3379. trade
#> # i 11,563 more rows
#> 

Details

The scope attribute recovers a distinction that earlier releases stored, misleadingly, as a tie weight on the membership relation. No organisation held both values, so the attribute belongs to the IGOs and not to their ties. The zeros were never absent ties: the only state with no UN tie is Taiwan, so reading a zero as an absence would invert the membership of every global body.

The Correlates of War Trade dataset codes missing trade values as -9. These 759 cells are recorded as missing rather than as negative trade values, so they appear in the object's Missings table and not among its ties. Earlier releases stored them as -9, which made the network read as signed.

Note two current limitations of {manynet}. A network with exactly two named modes is treated as two-mode, and therefore as undirected, so as_matrix(mpn_cow) returns a symmetrised trade layer. to_layer(mpn_cow, "trade") does not recover it either, because it maps the two ends of each arc to the wrong nodes. The ties stored in the object are complete and correctly directed. Until both are resolved, use mpn_cow_trade for any matrix-level analysis of trade. See stocnet/manynet#170 and stocnet/manynet#171.

References

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.

Pevehouse, Jon C.W., Timothy Nordstrom, 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.

Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.


One-mode interstate trade relations and two-mode state membership in IGOs (COW)

Description

mpn_cow combines these two datasets into one multilevel network. They are kept alongside it because {manynet} currently reads a network with two named modes as undirected, which symmetrises the trade layer of mpn_cow, and because to_layer() does not recover that layer either. See stocnet/manynet#170 and stocnet/manynet#171.

Usage

data(mpn_cow_trade)

data(mpn_cow_igo)

Format

#> -- # Interstate trade network --------------------------------------------------
#> # A labelled, weighted, directed network of 116 states and 10730 trade arcs
#> 
#> -- Nodes
#> # A tibble: 116 x 1
#>   label                   
#>   <chr>                   
#> 1 United States of America
#> 2 Canada                  
#> 3 Cuba                    
#> 4 Dominican Republic      
#> 5 Jamaica                 
#> 6 Trinidad and Tobago     
#> # i 110 more rows
#> 
#> -- Missings
#> # A tibble: 759 x 3
#>    from    to weight
#>   <int> <int>  <dbl>
#> 1     1    31     NA
#> 2     2    31     NA
#> 3     3    31     NA
#> 4     3    41     NA
#> 5     3    59     NA
#> 6     3    66     NA
#> # i 753 more rows
#> 
#> -- Ties
#> # A tibble: 10,730 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 10,724 more rows
#> 
#> -- # State IGO membership network ----------------------------------------------
#> # A labelled, two-mode network of 112 states and 40 IGOs and 839 membership
#> ties
#> 
#> -- Nodes
#> # A tibble: 152 x 4
#>   label       mode   polity2 scope
#>   <chr>       <chr>    <dbl> <chr>
#> 1 Afghanistan states      -7 <NA> 
#> 2 Albania     states       5 <NA> 
#> 3 Algeria     states      -3 <NA> 
#> 4 Angola      states      -6 <NA> 
#> 5 Argentina   states       8 <NA> 
#> 6 Australia   states      10 <NA> 
#> # i 146 more rows
#> 
#> -- Ties
#> # A tibble: 839 x 2
#>    from    to
#>   <int> <int>
#> 1     1   113
#> 2     1   114
#> 3     1   115
#> 4     1   116
#> 5     1   117
#> 6     1   118
#> # i 833 more rows
#> 

Details

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).

Source

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.

References

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.


One-mode Mexican power elite database (Knoke 1990)

Description

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).

Usage

data(mpn_elite_mex)

Format

#> 
#> -- # Mexican power elite network -----------------------------------------------
#> # A labelled, undirected network of 35 elites and 117 common belonging or
#> interest ties
#> 
#> -- Nodes
#> # A tibble: 35 x 8
#>   label    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
#> 
#> -- Ties
#> # 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
#> 

Details

Figure: mpn\_elite\_mex

References

Knoke, David. 1990. Political Networks: The Structural Perspective. Cambridge: Cambridge University Press.

Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge: Cambridge University Press.


Two-mode and three-mode American power elite database (Domhoff 2016)

Description

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).

Usage

data(mpn_elite_usa_advice)

data(mpn_elite_usa_money)

Format

#> -- # US think tank board network -----------------------------------------------
#> # A labelled, two-mode network of 14 directors and 20 think tanks and 46 board
#> membership ties
#> 
#> -- Nodes
#> # A tibble: 34 x 2
#>   label    mode     
#>   <chr>    <chr>    
#> 1 Albright directors
#> 2 Argyros  directors
#> 3 Armitage directors
#> 4 Curry    directors
#> 5 Fukuyama directors
#> 6 Gray     directors
#> # i 28 more rows
#> 
#> -- Ties
#> # 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
#> 
#> -- # US power elite network ----------------------------------------------------
#> # A labelled, multiplex, undirected network of 38 elites and 59 board
#> membership ties and 44 campaign contribution ties
#> 
#> -- Nodes
#> # A tibble: 38 x 2
#>   label    mode  
#>   <chr>    <chr> 
#> 1 Adkerson elites
#> 2 Akins    elites
#> 3 Banga    elites
#> 4 Boyce    elites
#> 5 Britt    elites
#> 6 Cannon   elites
#> # i 32 more rows
#> 
#> -- Ties
#> # A tibble: 103 x 3
#>    from    to layer           
#>   <int> <int> <chr>           
#> 1     1    27 board membership
#> 2     3    27 board membership
#> 3     4    27 board membership
#> 4     5    27 board membership
#> 5     7    27 board membership
#> 6     9    27 board membership
#> # i 97 more rows
#> 

Details

Figure: mpn\_elite\_usa

References

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.


Two-mode European Values Survey, 1990 and 2008 (EVS 2020)

Description

Superseded. These six datasets are superseded by mpn_evs_ita, mpn_evs_deu, and mpn_evs_gbr, which hold the same data as one longitudinal network for each country. They are kept for one release and will be removed in 1.8.0.

Usage

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)

Format

tbl_graph object based on an association matrix with 14 columns:

Welfare

1 if individual associated

Religious

1 if individual associated

Education.culture

1 if individual associated

Unions

1 if individual associated

Parties

1 if individual associated

Local.political.groups

1 if individual associated

Human.rights

1 if individual associated

Environmental.animal

1 if individual associated

Professional

1 if individual associated

Youth

1 if individual associated

Sports

1 if individual associated

Women

1 if individual associated

Peace

1 if individual associated

Health

1 if individual associated

An object of class stocnet (inherits from list) of length 5.

An object of class stocnet (inherits from list) of length 5.

An object of class stocnet (inherits from list) of length 5.

An object of class stocnet (inherits from list) of length 5.

An object of class stocnet (inherits from list) of length 5.

An object of class stocnet (inherits from list) of length 5.

Details

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.

Source

Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.

References

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.


Longitudinal two-mode European Values Study, 1990 and 2008 (EVS 2020)

Description

mpn_evs_ita, mpn_evs_deu, and mpn_evs_gbr each hold one country's European Values Study data for 1990 and 2008 in a single two-mode network. Respondents form the first mode and the 14 types of association form the second. The time tie attribute records the year, either 1990 or 2008.

Italy has 1198 respondents, Germany 1872, and the United Kingdom 1402.

Usage

data(mpn_evs_ita)

data(mpn_evs_deu)

data(mpn_evs_gbr)

Format

#> -- # Italy association membership network --------------------------------------
#> # A longitudinal, labelled, two-mode network of 1198 respondents and 14
#> associations and 2181 membership ties over 2 waves
#> 
#> -- Nodes
#> # A tibble: 1,212 x 2
#>   label        mode       
#>   <chr>        <chr>      
#> 1 199038000009 respondents
#> 2 199038000011 respondents
#> 3 199038000018 respondents
#> 4 199038000024 respondents
#> 5 199038000025 respondents
#> 6 199038000026 respondents
#> # i 1,206 more rows
#> 
#> -- Ties
#> # A tibble: 2,181 x 3
#>    from    to  time
#>   <int> <int> <dbl>
#> 1     8  1199  1990
#> 2    19  1199  1990
#> 3    31  1199  1990
#> 4    38  1199  1990
#> 5    41  1199  1990
#> 6    47  1199  1990
#> # i 2,175 more rows
#> 
#> -- # Germany association membership network ------------------------------------
#> # A longitudinal, labelled, two-mode network of 1872 respondents and 14
#> associations and 3631 membership ties over 2 waves
#> 
#> -- Nodes
#> # A tibble: 1,886 x 2
#>   label        mode       
#>   <chr>        <chr>      
#> 1 199027600001 respondents
#> 2 199027600005 respondents
#> 3 199027600007 respondents
#> 4 199027600009 respondents
#> 5 199027600027 respondents
#> 6 199027600029 respondents
#> # i 1,880 more rows
#> 
#> -- Ties
#> # A tibble: 3,631 x 3
#>    from    to  time
#>   <int> <int> <dbl>
#> 1     7  1873  1990
#> 2    12  1873  1990
#> 3    14  1873  1990
#> 4    37  1873  1990
#> 5    48  1873  1990
#> 6    66  1873  1990
#> # i 3,625 more rows
#> 
#> -- # United Kingdom association membership network -----------------------------
#> # A longitudinal, labelled, two-mode network of 1402 respondents and 14
#> associations and 2902 membership ties over 2 waves
#> 
#> -- Nodes
#> # A tibble: 1,416 x 2
#>   label        mode       
#>   <chr>        <chr>      
#> 1 199082600004 respondents
#> 2 199082600005 respondents
#> 3 199082600007 respondents
#> 4 199082600008 respondents
#> 5 199082600012 respondents
#> 6 199082600013 respondents
#> # i 1,410 more rows
#> 
#> -- Ties
#> # A tibble: 2,902 x 3
#>    from    to  time
#>   <int> <int> <dbl>
#> 1     6  1403  1990
#> 2     7  1403  1990
#> 3    13  1403  1990
#> 4    17  1403  1990
#> 5    33  1403  1990
#> 6    34  1403  1990
#> # i 2,896 more rows
#> 

Details

These are repeated cross-sections, not a panel. The European Values Study draws a new sample each round, so no respondent appears in both years.

Use over_time() rather than over_waves() on these objects. over_time() restricts each year to the respondents sampled in it. over_waves() keeps the whole node set in each wave, which understates the density of each year.

over_time(mpn_evs_ita, netrics::net_by_density, attribute = "time")

Source

Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.

References

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.


One-mode EU policy influence network, June 2004 (Christopoulos 2006)

Description

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.

Usage

data(mpn_ryanair)

Format

#> -- # EU policy influence network -----------------------------------------------
#> # A labelled, directed network of 20 policy actors and 177 interaction arcs
#> 
#> -- Nodes
#> # A tibble: 20 x 1
#>   label         
#>   <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
#> 
#> -- Ties
#> # A tibble: 177 x 2
#>    from    to
#>   <int> <int>
#> 1     1     2
#> 2     1     3
#> 3     1     4
#> 4     1     5
#> 5     1     6
#> 6     1     7
#> # i 171 more rows
#> 

Source

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.


Multilevel 112th Congress Senate network (Knoke et al. 2021)

Description

mpn_senate combines the two community networks of the 112th Congress into one multilevel network of 93 senators, 78 political action committees (PACs), and 25 key bills. The mode node attribute separates the three sets of nodes.

mpn_senate_dem and mpn_senate_rep are not party networks. The source files are named Fig8.1_SxPV_CommA, Fig8.2_SxPV_CommB, and Fig8.3_SxPV_Overlap, so they record two communities of one network and their intersection. The community node attribute holds "A", "B", or "both". The 20 senators and 32 PACs and bills marked "both" reproduce mpn_senate_over.

Usage

data(mpn_senate)

Format

#> -- # Senate contribution and voting network ------------------------------------
#> # A labelled, undirected network of 196 senators and 5861 contribution and vote
#> ties
#> 
#> -- Nodes
#> # A tibble: 196 x 3
#>   label      mode     community
#>   <chr>      <chr>    <chr>    
#> 1 Baucus     senators both     
#> 2 Begich     senators A        
#> 3 Bennet     senators A        
#> 4 Blumenthal senators A        
#> 5 Boxer      senators A        
#> 6 BrownSh    senators A        
#> # i 190 more rows
#> 
#> -- Missings
#> # A tibble: 2,542 x 3
#>    from    to weight
#>   <int> <int>  <dbl>
#> 1    52    94     NA
#> 2    53    94     NA
#> 3    54    94     NA
#> 4    55    94     NA
#> 5    56    94     NA
#> 6    57    94     NA
#> # i 2,536 more rows
#> 
#> -- Ties
#> # A tibble: 5,861 x 2
#>    from    to
#>   <int> <int>
#> 1     1    94
#> 2     2    94
#> 3     3    94
#> 4     4    94
#> 5     5    94
#> 6     6    94
#> # i 5,855 more rows
#> 

Details

Two points of care.

Cells that neither community covers were never observed. They are recorded as missing rather than as absent ties, so the object holds 2542 missing dyads.

The two communities overlap in 640 cells and disagree in 9 of them. Community A governs those cells: it agrees with Fig8.3_SxPV_Overlap in all 640, where community B differs in 9.

References

Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.


Two-mode 112th Congress Senate Voting (Knoke et al. 2021)

Description

Superseded. These three datasets are superseded by mpn_senate, which holds the same data as one multilevel network with a community node attribute. They are kept for one release and will be removed in 1.8.0.

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).

Usage

data(mpn_senate_dem)

data(mpn_senate_rep)

data(mpn_senate_over)

Format

#> -- # Senate community A --------------------------------------------------------
#> # A labelled, undirected network of 114 senators and 2791 contribution and vote
#> ties
#> 
#> -- Nodes
#> # A tibble: 114 x 2
#>   label      mode    
#>   <chr>      <chr>   
#> 1 Baucus     senators
#> 2 Begich     senators
#> 3 Bennet     senators
#> 4 Blumenthal senators
#> 5 Boxer      senators
#> 6 BrownSh    senators
#> # i 108 more rows
#> 
#> -- Ties
#> # A tibble: 2,791 x 2
#>    from    to
#>   <int> <int>
#> 1     1    52
#> 2     1    53
#> 3     1    54
#> 4     1    55
#> 5     1    56
#> 6     1    57
#> # i 2,785 more rows
#> 
#> -- # Senate community B --------------------------------------------------------
#> # A labelled, undirected network of 134 senators and 3675 contribution and vote
#> ties
#> 
#> -- Nodes
#> # A tibble: 134 x 2
#>   label     mode    
#>   <chr>     <chr>   
#> 1 Alexander senators
#> 2 Ayotte    senators
#> 3 Barrasso  senators
#> 4 Baucus    senators
#> 5 Blunt     senators
#> 6 Boozman   senators
#> # i 128 more rows
#> 
#> -- Ties
#> # A tibble: 3,675 x 2
#>    from    to
#>   <int> <int>
#> 1     1    64
#> 2     1    66
#> 3     1    67
#> 4     1    70
#> 5     1    71
#> 6     1    72
#> # i 3,669 more rows
#> 
#> -- # Senate community overlap --------------------------------------------------
#> # A labelled, undirected network of 52 senators and 614 contribution and vote
#> ties
#> 
#> -- Nodes
#> # A tibble: 52 x 2
#>   label     mode    
#>   <chr>     <chr>   
#> 1 Baucus    senators
#> 2 Cardin    senators
#> 3 Carper    senators
#> 4 Casey     senators
#> 5 Collins   senators
#> 6 Feinstein senators
#> # i 46 more rows
#> 
#> -- Ties
#> # A tibble: 614 x 2
#>    from    to
#>   <int> <int>
#> 1     1    21
#> 2     1    22
#> 3     1    23
#> 4     1    24
#> 5     1    25
#> 6     1    26
#> # i 608 more rows
#> 

References

Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. Multimodal Political Networks. Cambridge University Press. Cambridge University Press.


Predict methods for network regression

Description

Predict methods for network regression

Usage

## S3 method for class 'netlm'
predict(object, newdata = NULL, ...)

## S3 method for class 'netlogit'
predict(object, newdata = NULL, type = c("link", "response"), ...)

Arguments

object

An object of class inheriting "netlm" or "netlogit"

newdata

A design matrix with the same columns/variables as the fitted model.

...

Additional arguments (not used).

type

Character string, one of "response" (default, whether the returned predictions are on the probability scale) or "link" (returned predictions are on the scale of the linear predictor).

Value

A numeric vector of predicted values.

Examples

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
predict(model1, matrix(c(1,10,5,2),1,4))
networkers <- ison_networkers |> to_subgraph(Discipline == "Sociology") |> 
  to_unweighted()
model1 <- net_regression(. ~ ego(Citations) + alter(Citations) + sim(Citations),
                      networkers, times = 20)
# Should be run many more `times` for publication-ready results
predict(model1, matrix(c(1,10,5,2),1,4))

Objects exported from other packages

Description

These objects are imported from other packages. Follow the links below to see their documentation.

generics

glance(), tidy()


Linear and logistic regression for network data

Description

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:

Usage

net_regression(
  formula,
  .data,
  method = c("qap", "qapy"),
  times = 1000,
  strategy = "sequential",
  verbose = FALSE
)

Arguments

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:

  • ego() constructs a matrix where the cells reflect the value of a named nodal attribute for an edge's sending node

  • alter() constructs a matrix where the cells reflect the value of a named nodal attribute for an edge's receiving node

  • same() constructs a matrix where a 1 reflects if two nodes' attribute values are the same

  • dist() constructs a matrix where the cells reflect the absolute difference between the attribute's values for the sending and receiving nodes

  • sim() constructs a matrix where the cells reflect the proportional similarity between the attribute's values for the sending and receiving nodes

  • tertius() constructs a matrix where the cells reflect some aggregate of an attribute associated with a node's other ties. Currently "mean" and "sum" are available aggregating functions. 'ego' is excluded from these calculations. See Haunss and Hollway (2023) for more on this effect.

  • dyadic covariates (other networks) can just be named

.data

A manynet-consistent network. See e.g. manynet::as_tidygraph() for more details.

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, times=1000. 1,000 - 10,000 repetitions recommended for publication-ready results.

strategy

If {furrr} is installed, then multiple cores can be used to accelerate the function. By default "sequential", but if multiple cores available, then "multisession" or "multicore" may be useful. Generally this is useful only when times > 1000. See {furrr} for more.

verbose

Whether the function should report on its progress. By default FALSE. See {progressr} for more.

References

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.

See Also

Other models: test_distributions, tests

Examples

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)

Tests of network distributions

Description

These functions conduct tests of distributions:

Usage

test_distribution(diff_model1, diff_model2)

test_fit(diff_model, diff_models)

Arguments

diff_model1, diff_model2

diff_model objects

diff_model

A diff_model object is returned by play_diffusion() or as_diffusion() and contains a single empirical or simulated diffusion.

diff_models

A diff_models object is returned by play_diffusions() and contains a series of diffusion simulations.

Mahalanobis distance

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

See Also

Other models: regression, tests

Examples

 test_distribution(as_diffusion(play_diffusion(ison_networkers)),
             as_diffusion(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)

Tests of network measures

Description

These functions conduct tests of any network-level statistic:

Usage

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
)

Arguments

.data

A manynet-consistent network. See e.g. manynet::as_tidygraph() for more details.

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, times=1000. 1,000 - 10,000 repetitions recommended for publication-ready results.

strategy

If {furrr} is installed, then multiple cores can be used to accelerate the function. By default "sequential", but if multiple cores available, then "multisession" or "multicore" may be useful. Generally this is useful only when times > 1000. See {furrr} for more.

verbose

Whether the function should report on its progress. By default FALSE. See {progressr} for more.

See Also

Other models: regression, test_distributions

Examples

marvel_friends <- fict_marvel |> to_uniplex("relationship") |> 
  to_unsigned() |> to_giant() |> 
  to_subgraph(PowerOrigin == "Human")
(cugtest <- test_random(marvel_friends, net_by_heterophily, attribute = "Attractive",
   times = 200))
# plot(cugtest)
# (qaptest <- test_permutation(marvel_friends, 
#                 net_by_heterophily, attribute = "Attractive",
#                 times = 200))
# plot(qaptest)

Open and extract code from tutorials

Description

These functions make it easy to use the tutorials in the {manynet} and {migraph} packages:

Usage

run_tute(tute)

extract_tute(tute)

Arguments

tute

String, name of the tutorial (e.g. "tutorial2").