Learn R Programming

NetworkToolbox (version 1.1.2)

sim.swn: Simulate Small-world Network

Description

Simulates a small-world network based on specified topological properties. Data will also be simulated based on the true network structure

Usage

sim.swn(nodes, n, pos = 0.8, ran = c(0.3, 0.7), nei = 1, p = 0.5,
  corr = FALSE, replace = NULL, ordinal = FALSE, ordLevels = NULL)

Arguments

nodes

Number of nodes in the simulated network

n

Number of cases in the simulated dataset

pos

Proportion of positive correlations in the simulated network

ran

Range of correlations in the simulated network

nei

Adjusts the number of connections each node has to neighboring nodes (see sample_smallworld)

p

Adjusts the rewiring probability (default is .5). p > .5 rewires the simulated network closer to a random network. p < .5 rewires the simulated network closer to a lattice network

corr

Should the simualted network be a correlation network? Defaults to FALSE. Set to TRUE for a simulated correlation network

replace

If noise > 0, then should participants be sampled with replacement? Defaults to TRUE. Set to FALSE to not allow the potential for participants to be consecutively entered into the simulated dataset.

ordinal

Should simulated continuous data be converted to ordinal? Defaults to FALSE. Set to TRUE for simulated ordinal data

ordLevels

If ordinal = TRUE, then how many levels should be used? Defaults to NULL. Set to desired number of intervals (defaults to 5)

Value

Returns a list that includes the simulated network (simNetwork), simulated data (simData), and simulated correlation matrix (simRho)

References

Csardi, G., & Nepusz, T. (2006). The igraph software package for complex network research. InterJournal, Complex Systems, 1695(5), 1-9.

Examples

Run this code
# NOT RUN {
sim.norm <- sim.swn(25, 500, nei = 3)

sim.Likert <- sim.swn(25, 500, nei = 3,
replace = TRUE, ordinal = TRUE, ordLevels = 5)
# }

Run the code above in your browser using DataLab