diff --git a/.gitignore b/.gitignore index 7f0b2ca5..5ac925e3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ inst/doc .Rhistory .RData .Ruserdata -*.Rd data-raw/* docs/ working/* diff --git a/man/centrality.Rd b/man/centrality.Rd new file mode 100644 index 00000000..76d94445 --- /dev/null +++ b/man/centrality.Rd @@ -0,0 +1,108 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/centrality.R +\name{centrality} +\alias{centrality} +\alias{node_degree} +\alias{node_closeness} +\alias{node_betweenness} +\alias{node_eigenvector} +\title{Centrality for one- and two-mode networks} +\usage{ +node_degree( + object, + weights = NULL, + mode = "out", + loops = TRUE, + normalized = FALSE +) + +node_closeness( + object, + weights = NULL, + mode = "out", + normalized = FALSE, + cutoff = NULL +) + +node_betweenness( + object, + weights = NULL, + directed = TRUE, + cutoff = NULL, + nobigint = TRUE, + normalized = FALSE +) + +node_eigenvector( + object, + weights = NULL, + directed = FALSE, + options = igraph::arpack_defaults, + scale = FALSE, + normalized = FALSE +) +} +\arguments{ +\item{object}{Either an igraph graph object or a matrix.} + +\item{weights}{The weight of the edges to use for the calculation. +Will be evaluated in the context of the edge data.} + +\item{mode}{How should edges be followed. Ignored for undirected graphs} + +\item{loops}{Should loops be included in the calculation} + +\item{normalized}{For one-mode networks, should Borgatti and Everett normalization be applied?} + +\item{cutoff}{maximum path length to use during calculations} + +\item{directed}{Should direction of edges be used for the calculations} + +\item{nobigint}{Should big integers be avoided during calculations} + +\item{options}{Settings passed on to `igraph::arpack()`} + +\item{scale}{Should the scores be scaled to range between 0 and 1?} +} +\value{ +Depending on how and what kind of an object is passed to the function, +the function will return a `tidygraph` object where the nodes have been updated + +A numeric vector giving the betweenness centrality measure of each node. + +A numeric vector giving the eigenvector centrality measure of each node. +} +\description{ +These functions calculate common centrality measures for both one- and two-mode networks. +They accept as objects matrices and `igraph` graphs, +and can be used within a tidygraph workflow. +Importantly, these functions also offer correct normalization for two-mode networks. +} +\examples{ +node_degree(mpn_elite_mex) +node_degree(southern_women) +node_closeness(mpn_elite_mex) +node_closeness(southern_women) +node_betweenness(mpn_elite_mex) +node_betweenness(southern_women) +node_eigenvector(mpn_elite_mex) +node_eigenvector(southern_women) +} +\references{ +Borgatti, Stephen P., and Martin G. Everett. "Network analysis of 2-mode data." Social networks 19.3 (1997): 243-270. + +Faust, Katherine. "Centrality in affiliation networks." Social networks 19.2 (1997): 157-191. +} +\seealso{ +Other two-mode measures: +\code{\link{centralization}}, +\code{\link{graph_clustering}()}, +\code{\link{node_constraint}()}, +\code{\link{node_smallworld}()} + +Other node-level measures: +\code{\link{node_constraint}()}, +\code{\link{node_smallworld}()} +} +\concept{node-level measures} +\concept{two-mode measures} diff --git a/man/centralization.Rd b/man/centralization.Rd new file mode 100644 index 00000000..b0717972 --- /dev/null +++ b/man/centralization.Rd @@ -0,0 +1,73 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/centralization.R +\name{centralization} +\alias{centralization} +\alias{graph_degree} +\alias{graph_closeness} +\alias{graph_betweenness} +\title{Centralization for one- and two-mode networks} +\usage{ +graph_degree( + object, + directed = c("all", "out", "in", "total"), + normalized = TRUE +) + +graph_closeness( + object, + directed = c("all", "out", "in", "total"), + normalized = TRUE +) + +graph_betweenness( + object, + directed = c("all", "out", "in", "total"), + normalized = TRUE +) +} +\arguments{ +\item{object}{A matrix, igraph graph, or tidygraph object.} + +\item{directed}{Character string, “out” for out-degree, +“in” for in-degree, and "all" or “total” for the sum of the two. +For two-mode networks, "all" uses as numerator the sum of differences +between the maximum centrality score for the mode +against all other centrality scores in the network, +whereas "in" uses as numerator the sum of differences +between the maximum centrality score for the mode +against only the centrality scores of the other nodes in that nodeset.} + +\item{normalized}{Logical scalar, whether the centrality scores are normalized. +Different denominators are used depending on whether the object is one-mode or two-mode, +the type of centrality, and other arguments.} +} +\value{ +A single centralization score if the object was one-mode, +and two centralization scores if the object was two-mode. +In the case of a two-mode network, +to return just the score for the first nodeset (rows), +append `$nodes1` to the end of the function call or returned object. +To return just the score for the second nodeset (cols), +append `$nodes2` to the end of the function call or returned object. +} +\description{ +These functions measure the overall centralization for a network. +} +\examples{ +graph_degree(southern_women, directed = "in") +graph_closeness(southern_women, directed = "in") +graph_betweenness(southern_women, directed = "in") +} +\references{ +Borgatti, Stephen P, and Daniel S Halgin. 2011. ``Analyzing Affiliation Networks." In \emph{The SAGE Handbook of +Social Network Analysis}, edited by John Scott and Peter J Carrington, 417–33. London, UK: Sage. +} +\seealso{ +Other two-mode measures: +\code{\link{centrality}}, +\code{\link{graph_clustering}()}, +\code{\link{node_constraint}()}, +\code{\link{node_smallworld}()} +} +\concept{graph-level measures} +\concept{two-mode measures} diff --git a/man/convert.Rd b/man/convert.Rd new file mode 100644 index 00000000..51cc2136 --- /dev/null +++ b/man/convert.Rd @@ -0,0 +1,80 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/convert.R +\name{convert} +\alias{convert} +\alias{as_matrix} +\alias{as_igraph} +\alias{as_tidygraph} +\alias{is_twomode} +\title{migraph-consistent object classes} +\usage{ +as_matrix(object) + +as_igraph(object, twomode = FALSE) + +as_tidygraph(object, twomode = FALSE) + +is_twomode(object) +} +\arguments{ +\item{object}{A data frame edgelist, matrix, igraph, or tidygraph object.} + +\item{twomode}{An option to override the heuristics for distinguishing incidence +from adjacency matrices. By default FALSE.} +} +\value{ +An adjacency or incidence matrix, named if possible. + +An igraph graph object. + +A tidygraph tbl_graph class object + +A logical vector whether object is two-mode (TRUE) or not (FALSE) +} +\description{ +The `as_` functions in `{migraph}` +typically accept edgelists (as data frames), matrices, +igraph graph objects, or tidygraph tbl_graph objects, +coercing them into the class designated in the function name. +} +\details{ +Behaviour is a little different depending on the data format. + +If the data frame is a 2 column edgelist, +the first column will become the rows +and the second column will become the columns. +If the data frame is a 3 column edgelist, +then the third column will be used as +the cell values or tie weights. +If the data frame is more than 3 columns, +the first column is full of character strings (i.e. is named) +and the second column is numeric (e.g. 0 and 1) +then it will be assumed that this is a matrix +embedded in a data frame. + +Incidence matrices are typically inferred from unequal dimensions, +but since in rare cases a matrix with equal dimensions may still +be an incidence matrix, an additional argument `twomode` can be +specified to override this heuristic. +This information is usually already embedded in igraph and tidygraph objects. +} +\examples{ +\dontrun{ +test <- data.frame(id1 = c("A","B","B","C","C"), + id2 = c("I","G","I","G","H")) +as_matrix(test) +} +\dontrun{ +test <- data.frame(id1 = c("A","B","B","C","C"), + id2 = c("I","G","I","G","H")) +as_igraph(test) +} +\dontrun{ +test <- data.frame(id1 = c("A","B","B","C","C"), + id2 = c("I","G","I","G","H")) +as_tidygraph(test) +} +\dontrun{ +is_twomode(southern_women) +} +} diff --git a/man/create.Rd b/man/create.Rd new file mode 100644 index 00000000..06dce431 --- /dev/null +++ b/man/create.Rd @@ -0,0 +1,71 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/create.R +\name{create} +\alias{create} +\alias{create_empty} +\alias{create_complete} +\alias{create_ring} +\alias{create_components} +\title{Create networks that conform to particular structures} +\usage{ +create_empty(n) + +create_complete(n) + +create_ring(n, width = 1, directed = FALSE, ...) + +create_components(n, components = 2) +} +\arguments{ +\item{n}{Number of nodes. +If a single integer is given, the function will create a one-mode network. +If a vector of two integers is given, e.g. `n = c(5,10)`, +the function will create a two-mode network.} + +\item{width}{The width or breadth of the ring. This is typically double the degree.} + +\item{directed}{Whether the graph should be directed. By default FALSE.} + +\item{...}{Additional arguments passed on to igraph.} + +\item{components}{Number of components to create.} +} +\value{ +By default an igraph object will be returned, +but this can be coerced into other types of objects +using `as_matrix()` or `as_tidygraph()`. +} +\description{ +These functions create a host of different network objects. +Despite the common syntax, what distinguishes them from +those in other packages is that passing the `n` argument +a vector of \emph{two} integers will return a two-mode +network instead of a one-mode network. +} +\details{ +`create_empty()` creates an empty graph of the given dimensions. + +`create_complete()` creates a filled graph of the given dimensions. + +`create_ring()` creates a ring or chord graph of the given dimensions +that loops around is of a certain width or thickness. + +\code{create_components()} creates a graph in which the nodes are clustered +into separate components. +} +\examples{ +g <- create_empty(c(8,6)) +plot(g) +g <- create_complete(c(8,6)) +plot(g) +g <- create_ring(c(8,6), width = 2) +plot(g) +plot(create_components(c(10, 12), components = 3)) +} +\seealso{ +as_matrix as_tidygraph as_network + +Other creation: +\code{\link{sample}()} +} +\concept{creation} diff --git a/man/graph_clustering.Rd b/man/graph_clustering.Rd new file mode 100644 index 00000000..5b8d9e3a --- /dev/null +++ b/man/graph_clustering.Rd @@ -0,0 +1,51 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/clustering.R +\name{graph_clustering} +\alias{graph_clustering} +\title{Clustering for one-, two-, and three- mode networks} +\usage{ +graph_clustering(object, object2 = NULL) +} +\arguments{ +\item{object}{A one-mode or two-mode matrix, igraph, or tidygraph} + +\item{object2}{Optionally, a second (two-mode) matrix, igraph, or tidygraph} +} +\description{ +This function offers clustering methods for one-, two-, and three-mode networks. +} +\details{ +For one-mode networks, the function serves as a shallow wrapper for `igraph::transitivity`, +since global transitivity is a regular measure for clustering or local density in one-mode networks. + +For two-mode networks, we calculate the proportion of three-paths in the network +that are closed by fourth tie to establish a "shared four-cycle" structure. + +For three-mode networks, we calculate the proportion of three-paths spanning the two two-mode networks +that are closed by a fourth tie to establish a "congruent four-cycle" structure. +} +\examples{ +graph_clustering(southern_women) +} +\references{ +Robins, Garry L, and Malcolm Alexander. 2004. +Small worlds among interlocking directors: Network structure and distance in bipartite graphs. +\emph{Computational & Mathematical Organization Theory} 10 (1): 69–94. + +Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. +\href{https://www.cambridge.org/core/books/multimodal-political-networks/43EE8C192A1B0DCD65B4D9B9A7842128}{\emph{Multimodal Political Networks}}. +Cambridge University Press. Cambridge University Press. +} +\seealso{ +Other one-mode measures: +\code{\link{node_constraint}()} + +Other two-mode measures: +\code{\link{centrality}}, +\code{\link{centralization}}, +\code{\link{node_constraint}()}, +\code{\link{node_smallworld}()} +} +\concept{one-mode measures} +\concept{three-mode measures} +\concept{two-mode measures} diff --git a/man/mpn_bristol.Rd b/man/mpn_bristol.Rd new file mode 100644 index 00000000..3ead0e9c --- /dev/null +++ b/man/mpn_bristol.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data_bristol.R +\docType{data} +\name{mpn_bristol} +\alias{mpn_bristol} +\title{Bristol protest events, 1990-2002} +\format{ +A matrix with 264 rows and columns. Node IDs are prefaced with a type identifier: +\describe{ + \item{1_}{150 Individuals, anonymised} + \item{2_}{97 Bristol Civic Organizations} + \item{3_}{17 Major Protest and Civic Events in Bristol, 1990-2002} +} +} +\source{ +Knoke, Diani, Hollway, and Christopoulos. 2021. \emph{Multimodal Political Networks}. Cambridge University Press: Cambridge. +} +\usage{ +mpn_bristol +} +\description{ +A multimodal (3) matrix containing individuals affiliations to civic organizations +in Bristol and their participation in major protest and civic events between 1990-2002, +and the involvement of the organizations in these events. +} +\keyword{datasets} diff --git a/man/mpn_elite_mex.Rd b/man/mpn_elite_mex.Rd new file mode 100644 index 00000000..db78551b --- /dev/null +++ b/man/mpn_elite_mex.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data_elite_mex.R +\docType{data} +\name{mpn_elite_mex} +\alias{mpn_elite_mex} +\title{One-mode Mexican power elite database} +\format{ +Matrix with 11 rows/columns +} +\source{ +Knoke, David. 1990. \emph{Political Networks}. + +Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. +\href{https://www.cambridge.org/core/books/multimodal-political-networks/43EE8C192A1B0DCD65B4D9B9A7842128}{\emph{Multimodal Political Networks}}. +Cambridge University Press. Cambridge University Press. +} +\usage{ +data(mpn_elite_mex) +} +\description{ +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). +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). +} +\keyword{datasets} diff --git a/man/mpn_elite_usa_advice.Rd b/man/mpn_elite_usa_advice.Rd new file mode 100644 index 00000000..024b6e4c --- /dev/null +++ b/man/mpn_elite_usa_advice.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data_elite_usa_advice.R +\docType{data} +\name{mpn_elite_usa_advice} +\alias{mpn_elite_usa_advice} +\title{Two-mode American power elite database} +\format{ +Matrix with 14 rows and 20 columns +} +\usage{ +data(mpn_elite_usa_advice) +} +\description{ +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. +} +\references{ +Domhoff, G William. 2016. \href{http://www2.ucsc.edu/whorulesamerica/power_elite/}{“Who Rules America? Power Elite Database.”} + +Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. +\href{https://www.cambridge.org/core/books/multimodal-political-networks/43EE8C192A1B0DCD65B4D9B9A7842128}{\emph{Multimodal Political Networks}}. +Cambridge University Press. Cambridge University Press. +} +\keyword{datasets} diff --git a/man/mpn_elite_usa_money.Rd b/man/mpn_elite_usa_money.Rd new file mode 100644 index 00000000..56c6c22a --- /dev/null +++ b/man/mpn_elite_usa_money.Rd @@ -0,0 +1,30 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data_elite_usa_money.R +\docType{data} +\name{mpn_elite_usa_money} +\alias{mpn_elite_usa_money} +\title{Three-mode American power elite database} +\format{ +Matrix with 26 rows and 6+6 columns +} +\usage{ +data(mpn_elite_usa_money) +} +\description{ +This data 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). +} +\references{ +Domhoff, G William. 2016. \href{http://www2.ucsc.edu/whorulesamerica/power_elite/}{“Who Rules America? Power Elite Database.”} + +The Center for Responsive Politics. 2019. \href{http://www.opensecrets.org}{“OpenSecrets.”} + +Knoke, David, Mario Diani, James Hollway, and Dimitris C Christopoulos. 2021. +\href{https://www.cambridge.org/core/books/multimodal-political-networks/43EE8C192A1B0DCD65B4D9B9A7842128}{\emph{Multimodal Political Networks}}. +Cambridge University Press. Cambridge University Press. +} +\keyword{datasets} diff --git a/man/mpn_evs.Rd b/man/mpn_evs.Rd new file mode 100644 index 00000000..f0becb87 --- /dev/null +++ b/man/mpn_evs.Rd @@ -0,0 +1,65 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data_evs.R +\docType{data} +\name{mpn_evs} +\alias{mpn_evs} +\alias{mpn_IT_1990} +\alias{mpn_IT_2008} +\alias{mpn_DE_1990} +\alias{mpn_DE_2008} +\alias{mpn_UK_1990} +\alias{mpn_UK_2008} +\title{European Values Survey, 1990 and 2008} +\format{ +Matrices with 14 columns: +\describe{ + \item{Welfare}{1 if individual associated} + \item{Religious}{1 if individual associated} + \item{Education.culture}{1 if individual associated} + \item{Unions}{1 if individual associated} + \item{Parties}{1 if individual associated} + \item{Local.political.groups}{1 if individual associated} + \item{Human.rights}{1 if individual associated} + \item{Environmental.animal}{1 if individual associated} + \item{Professional}{1 if individual associated} + \item{Youth}{1 if individual associated} + \item{Sports}{1 if individual associated} + \item{Women}{1 if individual associated} + \item{Peace}{1 if individual associated} + \item{Health}{1 if individual associated} +} + +An object of class \code{tbl_graph} (inherits from \code{igraph}) of length 10. + +An object of class \code{tbl_graph} (inherits from \code{igraph}) of length 10. + +An object of class \code{tbl_graph} (inherits from \code{igraph}) of length 10. + +An object of class \code{tbl_graph} (inherits from \code{igraph}) of length 10. + +An object of class \code{tbl_graph} (inherits from \code{igraph}) of length 10. +} +\source{ +Knoke, Diani, Hollway, and Christopoulos. 2021. \emph{Multimodal Political Networks}. Cambridge University Press: Cambridge. +} +\usage{ +data(mpn_IT_1990) + +data(mpn_IT_2008) + +data(mpn_DE_1990) + +data(mpn_DE_2008) + +data(mpn_UK_1990) + +data(mpn_UK_2008) +} +\description{ +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. +} +\keyword{datasets} diff --git a/man/mpn_ryanair.Rd b/man/mpn_ryanair.Rd new file mode 100644 index 00000000..356f917c --- /dev/null +++ b/man/mpn_ryanair.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data_ryanair.R +\docType{data} +\name{mpn_ryanair} +\alias{mpn_ryanair} +\title{Ryanair data, EU policy influence network in June 2004} +\format{ +Matrix with 20 rows/columns +} +\source{ +Christopoulos, Dimitrios C. 2006. +“Relational Attributes of Political Entrepreneurs: a Network Perspective.” +\emph{Journal of European Public Policy} 13 (5): 757–78. + +Knoke, Diani, Hollway, and Christopoulos. 2021. \emph{Multimodal Political Networks}. Cambridge University Press: Cambridge. +} +\usage{ +data(mpn_ryanair) +} +\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. +} +\keyword{datasets} diff --git a/man/mpn_senate112.Rd b/man/mpn_senate112.Rd new file mode 100644 index 00000000..1d077814 --- /dev/null +++ b/man/mpn_senate112.Rd @@ -0,0 +1,46 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data_senate112.R +\docType{data} +\name{mpn_senate112} +\alias{mpn_senate112} +\alias{mpn_DemSxP} +\alias{mpn_RepSxP} +\alias{mpn_OverSxP} +\title{112th Congress Senate Voting} +\format{ +Matrix of 51 rows (Senators) and 63 columns (PACS) + +Matrix of 62 rows (Senators) and 72 columns (PACS) + +Matrix of 20 rows (Senators) and 32 columns (PACS) +} +\source{ +Knoke, Diani, Hollway, and Christopoulos. 2021. \emph{Multimodal Political Networks}. Cambridge University Press: Cambridge. +} +\usage{ +data(mpn_DemSxP) + +data(mpn_RepSxP) + +data(mpn_OverSxP) +} +\description{ +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 we analyzed is 102. +} +\details{ +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). +} +\keyword{datasets} diff --git a/man/netlm.Rd b/man/netlm.Rd new file mode 100644 index 00000000..403b6b56 --- /dev/null +++ b/man/netlm.Rd @@ -0,0 +1,69 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/netlm.R +\name{netlm} +\alias{netlm} +\alias{summary.netlm} +\alias{print.summary.netlm} +\title{Linear regression for multimodal network data} +\usage{ +netlm(formula, data, ...) + +\method{summary}{netlm}(object, reps = 1000, ...) + +\method{print}{summary.netlm}( + x, + digits = max(3, getOption("digits") - 3), + signif.stars = getOption("show.signif.stars"), + ... +) +} +\arguments{ +\item{formula}{A formula describing the relationship being tested.} + +\item{data}{A named list of matrices, graphs, or a tidygraph object.} + +\item{...}{Arguments passed on to `lm()`.} + +\item{object}{an object of class "netlm", usually as a result of a call to `netlm()`.} + +\item{reps}{Integer indicating the number of draws to use 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, reps=1000.} + +\item{x}{an object of class "summary.netlm", usually, a result of a call to `summary.netlm()`.} + +\item{digits}{the number of significant digits to use when printing.} + +\item{signif.stars}{logical. If TRUE, ‘significance stars’ are printed for each coefficient.} +} +\description{ +This function extends the multiple regression quadratic assignment procedure (MRQAP) +of network linear model to two mode networks. +} +\examples{ +\dontrun{ +mat1 <- matrix(c(0,1,1,0,0,1,1,1),4,2) +mat2 <- matrix(c(0,1,0,1,0,1,0,1),4,2) +mat3 <- matrix(c(0,0,1,1,0,0,1,1),4,2) +lmat <- list(mat1 = mat1, mat2 = mat2, mat3 = mat3) +example <- netlm(mat1 ~ mat2 + mat3 + lmat) +} +\dontrun{ +mat1 <- matrix(c(0,1,1,0,0,1,1,1),4,2) +mat2 <- matrix(c(0,1,0,1,0,1,0,1),4,2) +mat3 <- matrix(c(0,0,1,1,0,0,1,1),4,2) +lmat <- list(mat1 = mat1, mat2 = mat2, mat3 = mat3) +example <- netlm(mat1 ~ mat2 + mat3 + lmat) +summary.netlm(example) +} +\dontrun{ +mat1 <- matrix(c(0,1,1,0,0,1,1,1),4,2) +mat2 <- matrix(c(0,1,0,1,0,1,0,1),4,2) +mat3 <- matrix(c(0,0,1,1,0,0,1,1),4,2) +lmat <- list(mat1 = mat1, mat2 = mat2, mat3 = mat3) +example <- netlm(mat1 ~ mat2 + mat3 + lmat) +summary.netlm(example) +print.summary.netlm(example) +} +} diff --git a/man/node_constraint.Rd b/man/node_constraint.Rd new file mode 100644 index 00000000..7ab73267 --- /dev/null +++ b/man/node_constraint.Rd @@ -0,0 +1,52 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/constraint.R +\name{node_constraint} +\alias{node_constraint} +\title{Constraint for one- and two-mode networks} +\usage{ +node_constraint(object, nodes = V(object), weights = NULL) +} +\arguments{ +\item{object}{A matrix, igraph graph, or tidygraph object.} + +\item{nodes}{The vertices for which the constraint will be calculated. +Defaults to all vertices.} + +\item{weights}{The weights of the edges. +If this is NULL and there is a weight edge attribute this is used. +If there is no such edge attribute all edges will have the same weight.} +} +\value{ +A named vector (one-mode) or a list of two named vectors (`$nodes1`, `$nodes2`). +} +\description{ +This function measures constraint for both one-mode and two-mode networks. +For one-mode networks, the function wraps the implementation of Ron Burt's measure +in `{igraph}`. +For two-mode networks, the function employs the extension outlined in Hollway et al. (2020). +} +\examples{ +node_constraint(southern_women) +} +\references{ +Hollway, James, Jean-Frédéric Morin, and Joost Pauwelyn. 2020. +\href{https://link.springer.com/article/10.1007/s10784-019-09464-5}{"Structural conditions for novelty: the introduction of new environmental clauses to the trade regime complex."} +\emph{International Environmental Agreements: Politics, Law and Economics} 20 (1): 61–83. +} +\seealso{ +Other one-mode measures: +\code{\link{graph_clustering}()} + +Other two-mode measures: +\code{\link{centrality}}, +\code{\link{centralization}}, +\code{\link{graph_clustering}()}, +\code{\link{node_smallworld}()} + +Other node-level measures: +\code{\link{centrality}}, +\code{\link{node_smallworld}()} +} +\concept{node-level measures} +\concept{one-mode measures} +\concept{two-mode measures} diff --git a/man/node_smallworld.Rd b/man/node_smallworld.Rd new file mode 100644 index 00000000..d39bc7c0 --- /dev/null +++ b/man/node_smallworld.Rd @@ -0,0 +1,48 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/smallworld.R +\name{node_smallworld} +\alias{node_smallworld} +\title{Watts-Strogatz small-world model for two-mode networks} +\usage{ +node_smallworld(object, n = 100) +} +\arguments{ +\item{object}{A matrix, igraph graph, or tidygraph object} + +\item{n}{Number of simulations} +} +\value{ +Returns a table of small-world related metrics for each second-mode node. +} +\description{ +Calculates small-world metrics for two-mode networks +} +\details{ +The first column of the returned table is simply the number of the second-mode column. +The next three columns report the observed and expected clustering, +and the ratio of the former to the later. +The next three columns report the observed and expected path-length, +and the ratio of the former to the later. +The last column reports the ratio of the observed/expected clustering ratio +to the observed/expected path-length ratio, which is known as a small-world metric. +Expected clustering and paths is the mean of twomode_clustering and mean_distance +over 100 random simulations with the same row and column sums. +} +\examples{ +node_smallworld(southern_women) +} +\seealso{ +\code{\link{graph_clustering}} for how clustering is calculated + +Other two-mode measures: +\code{\link{centrality}}, +\code{\link{centralization}}, +\code{\link{graph_clustering}()}, +\code{\link{node_constraint}()} + +Other node-level measures: +\code{\link{centrality}}, +\code{\link{node_constraint}()} +} +\concept{node-level measures} +\concept{two-mode measures} diff --git a/man/plot.igraph.Rd b/man/plot.igraph.Rd new file mode 100644 index 00000000..635dff9a --- /dev/null +++ b/man/plot.igraph.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/plot.R +\name{plot.igraph} +\alias{plot.igraph} +\title{Plotting of one-mode and two-mode graphs} +\usage{ +\method{plot}{igraph}(x, ...) +} +\arguments{ +\item{x}{A migraph-compatible object, especially an igraph graph object} + +\item{...}{Additional arguments passed on to igraph.} +} +\description{ +Plotting of one-mode and two-mode graphs +} +\examples{ +mat1 <- create_ring(5,10) +plot.igraph(mat1) +} +\concept{plotting} diff --git a/man/project.Rd b/man/project.Rd new file mode 100644 index 00000000..66efd4b7 --- /dev/null +++ b/man/project.Rd @@ -0,0 +1,39 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/project.R +\name{project} +\alias{project} +\alias{project_rows} +\alias{project_cols} +\title{Projecting two-mode objects into one-mode objects} +\usage{ +project_rows(object) + +project_cols(object) +} +\arguments{ +\item{object}{A matrix, `igraph` graph or `tidygraph` tbl_graph object.} +} +\description{ +These functions 'project' or convert a two-mode object +in any format -- tidygraph, igraph, or matrix -- +into a corresponding one-mode object. +} +\details{ +`project_rows()` results in a weighted one-mode object +that retains the row nodes from a two-mode object, +and weights the ties between them on the basis of +their joint ties to nodes in the second mode (columns). + +`project_cols()` results in a weighted one-mode object +that retains the column nodes from a two-mode object, +and weights the ties between them on the basis of +their joint ties to nodes in the first mode (rows). +} +\examples{ +\dontrun{ +project_rows(southern_women) +} +\dontrun{ +project_cols(southern_women) +} +} diff --git a/man/reexports.Rd b/man/reexports.Rd new file mode 100644 index 00000000..620d8db6 --- /dev/null +++ b/man/reexports.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/reexports_igraph.R, R/reexports_tidygraph.R +\docType{import} +\name{reexports} +\alias{reexports} +\alias{is.igraph} +\alias{is_bipartite} +\alias{\%>\%} +\alias{with_graph} +\alias{is.tbl_graph} +\alias{.G} +\alias{.N} +\alias{.E} +\title{Objects exported from other packages} +\keyword{internal} +\description{ +These objects are imported from other packages. Follow the links +below to see their documentation. + +\describe{ + \item{igraph}{\code{\link[igraph:is_igraph]{is.igraph}}, \code{\link[igraph:make_bipartite_graph]{is_bipartite}}} + + \item{magrittr}{\code{\link[magrittr:pipe]{\%>\%}}} + + \item{tidygraph}{\code{\link[tidygraph:context_accessors]{.E}}, \code{\link[tidygraph:context_accessors]{.G}}, \code{\link[tidygraph:context_accessors]{.N}}, \code{\link[tidygraph:tbl_graph]{is.tbl_graph}}, \code{\link[tidygraph]{with_graph}}} +}} + diff --git a/man/sample.Rd b/man/sample.Rd new file mode 100644 index 00000000..717911e1 --- /dev/null +++ b/man/sample.Rd @@ -0,0 +1,40 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sample.R +\name{sample} +\alias{sample} +\alias{sample_affiliation} +\title{Sample networks according to certain probabilities} +\usage{ +sample_affiliation(n, p, m) +} +\arguments{ +\item{n}{Integer vector of length 2. +The first number is the number of nodes in the first nodeset (rows), +and the second number becomes the number of nodes in the second nodeset (columns).} + +\item{p}{Number of edges in the network over the number of edges possible} + +\item{m}{Number of edges in the network} + +\item{as}{What type of object to return. +One of "matrix", "tidygraph", "igraph". +By default, creates tidygraph's "tbl_graph" object.} +} +\description{ +Sample networks according to certain probabilities +} +\details{ +Creates a random two-mode network. +Will construct an affiliation matrix, +with a certain probability of a tie. +} +\examples{ +sample_affiliation(c(10, 12), 0.25) \%>\% ggraph::ggraph() + +ggraph::geom_edge_fan(ggplot2::aes(alpha = stat(index)), show.legend = FALSE) + +ggraph::geom_node_point(ggplot2::aes(size = 5)) +} +\seealso{ +Other creation: +\code{\link{create}} +} +\concept{creation} diff --git a/man/southern_women.Rd b/man/southern_women.Rd new file mode 100644 index 00000000..1f275dee --- /dev/null +++ b/man/southern_women.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data_southern_women.R +\docType{data} +\name{southern_women} +\alias{southern_women} +\title{Two-mode southern women dataset} +\format{ +igraph graph object +} +\usage{ +data(southern_women) +} +\description{ +Two-mode network dataset collected by Davis, Gardner and Gardner (1941) about women and social events. +} +\references{ +Davis, A., Gardner, B., and Gardner, R. 1941. \emph{Deep South}. +Chicago: University of Chicago Press. +} +\keyword{datasets}