sim.swn: Simulate Small-world Network

Description Usage Arguments Value Author(s) References Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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 simulated 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 containing:

simNetwork

Adjacency matrix of the simulated network

simData

Simulated data from sim.correlation in the psych package based on the simulated network

simRho

Simulated correlation from sim.correlation in the psych package

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>

References

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

Examples

1
2
3
4
5
6
7
8
#Continuous data
sim.Norm <- sim.swn(25, 500, nei = 3)

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

#Dichotomous data
sim.Binary <- sim.swn(25, 500, nei = 3, replace = TRUE, ordinal = TRUE, ordLevels = 2)

NetworkToolbox documentation built on May 28, 2021, 5:11 p.m.