Learn R Programming

EGAnet (version 2.4.0)

simEGM: Simulate data following a Exploratory Graph Model (EGM)

Description

Function to simulate data based on EGM

Usage

simEGM(
  communities,
  variables,
  loadings,
  cross.loadings = 0.01,
  correlations,
  sample.size,
  quality = c("acceptable", "robust"),
  max.iterations = 100
)

Arguments

communities

Numeric (length = 1). Number of communities to generate

variables

Numeric vector (length = 1 or communities). Number of variables per community

loadings

Numeric (length = 1, communities, or total variables \(\times\) communities). Magnitude of the assigned network loadings. For reference, small (0.20), moderate (0.35), and large (0.50). Input can be a loading matrix but must have the dimensions: total variables \(\times\) communities

Uses runif(n, min = value - 0.025, max = value + 0.025) for some jitter in the loadings

cross.loadings

Numeric (length = 1). Standard deviation of a normal distribution with a mean of zero (n, mean = 0, sd = value). Defaults to 0.01. Not recommended to change too drastically (small increments such as 0.01 work best)

correlations

Numeric (length = 1 or communities \(\times\) communities matrix). Magnitude of the community correlations. Input can be a correlations matrix but must have the dimensions: communities \(\times\) communities

sample.size

Numeric (length = 1). Number of observations to generate

quality

Character (length = 1). Quality metrics related to the alignment of the correlations implied by the loadings and network are computed with certain standards in place to accept a solution. These metrics include:

  • SRMR (or RMSE) --- standardized root mean residual where acceptable equals 0.02 and robust equals 0.01

  • MAE --- mean absolute error where acceptable equals 0.02 and robust equals 0.01

  • frobenius --- Frobenius norm where acceptable equals 0.90 and robust equals 0.95

  • jsd --- Jensen-Shannon Distance where acceptable equals 0.10 and robust equals 0.05

Defaults to "acceptable". "robust" is available but most often needs density.power to be increased to allow for more cross-loadings to converge

max.iterations

Numeric (length = 1). Number of iterations to attempt to get convergence before erroring out. Defaults to 100

Author

Hudson F. Golino <hfg9s at virginia.edu> and Alexander P. Christensen <alexpaulchristensen@gmail.com>

Examples

Run this code
simulated <- simEGM(
  communities = 2, variables = 6,
  loadings = 0.35, # use network loading sizes
  correlations = 0.30, sample.size = 1000
)

Run the code above in your browser using DataLab