Skip to contents

Collects the inputs needed to simulate prior studies for a Gaussian graphical model, then passes the result to simulate_prior_study.

Usage

ggm_study(p, nu, G = NULL, structure = NULL, ...)

Arguments

p

Number of nodes. Must be at least 3.

nu

Prior study size: the number of observations each simulated study collects. Must exceed p.

G

A p by p symmetric 0/1 adjacency matrix with zero diagonal. Supply this argument to hold the graph fixed across studies, so that only the estimated precision matrix varies.

structure

A graph generator, as in generate_graph. Supply this argument instead of G to draw a new graph for each study.

...

Further arguments for the generator, e.g. prob for "structure = Bernoulli". Only used with structure.

Value

A ggm_study object, which also inherits from bgm_study.

Examples

# fixed graph: only the precision matrix varies across simulated studies
p <- 4
G <- matrix(0, p, p)
G[1, 2] <- G[2, 1] <- 1
G[3, 4] <- G[4, 3] <- 1
study1 <- ggm_study(p = p, nu = 20, G = G)

# random graph: a new structure is drawn for each simulated study
study2 <- ggm_study(p = p, nu = 20, structure = "Bernoulli", prob = 0.3)