dgm_sim_from_graph: Simulate observations from a decomposable graphical model

Description Usage Arguments Value Examples

View source: R/api_dgmsim.R

Description

Simulate observations from a decomposable graphical model

Usage

1
dgm_sim_from_graph(g, lvls, nsim = 1000, cell_rate = 0.5)

Arguments

g

An adjacency list

lvls

Named list with levels of the discrete variables

nsim

Number of simulations

cell_rate

Control discrete cell probabilities

Value

This function returns a matrix of dimension where each row correspond to a simulated observation from a DGM represented by g.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
g = list(
  A = c("B", "X", "Y"),
  B = c("A", "Y"),
  X = c("A", "Y"),
  Y = c("A", "X", "B")
)

lvls <- list(
  A = c("0", "1"),
  B = c("0", "1"),
  X = c("a", "b", "c"),
  Y = c("0", "1", "2")
)

dgm_sim_from_graph(g, lvls, nsim = 10)
#'

ess documentation built on May 31, 2021, 9:10 a.m.