sim.chordal: Simulate Chordal Network

Description Usage Arguments Value Author(s) References Examples

View source: R/sim.chordal.R

Description

Simulates a chordal network based on number of nodes. Data will also be simulated based on the true network structure

Usage

1
2
3
4
5
6
7
8
9
sim.chordal(
  nodes,
  inverse = c("cases", "matrix"),
  n = NULL,
  ordinal = FALSE,
  ordLevels = NULL,
  idio = NULL,
  eps = NULL
)

Arguments

nodes

Numeric. Number of nodes in the simulated network

inverse

Character. Method to produce inverse covariance matrix.

  • "cases"Estimates inverse covariance matrix based on n number of cases and nodes number of variables, which are drawn from a random normal distribution rnorm. Data generated will be continuous unless ordinal is set to TRUE

  • "matrix"Estimates inverse covariance matrix based on ??eps??

n

Numeric. Number of cases in the simulated dataset

ordinal

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

ordLevels

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

idio

Numeric. DESCRIPTION. Defaults to 0.10

eps

Numeric. DESCRIPTION. Defaults to 2

Value

Returns a list containing:

cliques

The cliques in the network

separators

The separators in the network

inverse

Simulated inverse covariance matrix of the network

data

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

Author(s)

Guido Previde Massara <gprevide@gmail.com>

References

Massara, G. P. & Aste, T. (2019). Learning clique forests. ArXiv.

Examples

1
2
3
4
5
6
7
8
#Continuous data
sim.Norm <- sim.chordal(nodes = 20, inverse = "cases", n = 1000)

#Ordinal data
sim.Likert <- sim.chordal(nodes = 20, inverse = "cases", n = 1000, ordinal = TRUE)

#Dichotomous data
sim.Binary <- sim.chordal(nodes = 20, inverse = "cases", n = 1000, ordinal = TRUE, ordLevels = 5)

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