Learn R Programming

networktools (version 1.2.1)

impact: Network Impact (combined function)

Description

Generates the global strength impact, network structure impact, and edge impact simultaneously for a given set of nodes. See global.impact, structure.impact, and edge.impact for additional details

Usage

impact(input, gamma, nodes = c("all"), binary.data = FALSE,
  weighted = TRUE, split = c("median", "mean", "forceEqual",
  "cutEqual", "quartiles"))

Arguments

input

a matrix or data frame of observations (not a network/edgelist). See included example datasets depression and social.

gamma

the sparsity parameter used in generating networks. Defaults to 0.5 for interval data and 0.25 for binary data

nodes

indicates which nodes should be tested. Can be given as a character string of desired nodes (e.g., c("node1","node2")) or as a numeric vector of column numbers (e.g., c(1,2)).

binary.data

logical. Indicates whether the input data is binary

weighted

logical. Indicates whether resultant networks preserve edge weights or binarize edges.

split

method by which to split network given non-binary data. "median": median split (excluding the median), "mean": mean split, "forceEqual": creates equally sized groups by partitioning random median observations to the smaller group, "cutEqual": creates equally sized groups by deleting random values from the bigger group,"quartile": uses the top and bottom quartile as groups

Value

impact returns a list of class "all.impact" which contains:

1. A list of class "global.impact"

2. A list of class "structure.impact"

3. A list of class "edge.impact"

See global.impact, structure.impact, and edge.impact for details on each list

Details

The structures of networks sometimes vary as a function of certain external variables. For instance, Pe et al. (2015) found that the structure of mood networks varied as a function of whether or not individuals had been diagnosed with major depression.

The structures of networks may also vary as a function of internal variables; that is to say, as a function of each node. Impact statistics measure the degree to which node levels impact network structure. Impact statistics are similar to centrality statistics in the sense that they are a property of each node in a network.

Three relevant impact statistics are included in the networktools package: global strength impact, network structure impact, and edge impact. To ease computational burden, all three statistics are calculated simultaneously in the impact function. They can also be calculated separately using global.impact, structure.impact, and edge.impact.

Impact statistics are calculated by temporarily regarding a node as an external variable to the network. The remaining data are then divided into two networks according to a median split (default) on the external node. Network invariance measures are then computed on the two networks. While median splits are not advisable when continuous analyses are possible, it is not possible to compute networks in a continuous fashion. The median split excludes observations that fall exactly on the median. In the case of binary data, data are split by level rather than by median.

Examples

Run this code
# NOT RUN {
out <- impact(depression[,1:3])
# }
# NOT RUN {
out1 <- impact(depression)
out2 <- impact(depression, gamma=0.65, nodes=c("sleep_disturbance", "psychomotor_retardation"))
out3 <- impact(social, binary.data=TRUE)
out4 <- impact(social, nodes=c(1:6, 9), binary.data=TRUE)

summary(out1)
plot(out1)

# Extract the impact of psychomotor_retardation on the
# edge that runs between worthlessness and fatigue
out1$Edge$impact[["psychomotor_retardation"]]["worthlessness", "fatigue"]

# Extract edge impacts of node Dan in edgelist format
out3$Edge$edgelist$Dan

# Visualize edge impacts of psychomotor_retardation
# as a single network
plot(out1$Edge, nodes="psychomotor_retardation", type.edgeplot="single")

# Visualize the edge impacts of psychomotor_retardation
# as contrast between high and low
plot(out1$Edge, nodes="psychomotor_retardation", type.edgeplot="contrast")

# }

Run the code above in your browser using DataLab