# Simple draws
model <- make_model("X -> M -> Y")
make_data(model)
make_data(model, n = 3, nodes = c("X","Y"))
make_data(model, n = 3, param_type = "prior_draw")
make_data(model, n = 10, param_type = "define", parameters = 0:9)
# Data Strategies
# A strategy in which X, Y are observed for sure and M is observed
# with 50% probability for X=1, Y=0 cases
model <- make_model("X -> M -> Y")
make_data(
model,
n = 8,
nodes = list(c("X", "Y"), "M"),
probs = list(1, .5),
subsets = list(TRUE, "X==1 & Y==0"))
# n not provided but inferred from largest n_step (not from sum of n_steps)
make_data(
model,
nodes = list(c("X", "Y"), "M"),
n_steps = list(5, 2))
# Wide then deep
make_data(
model,
n = 8,
nodes = list(c("X", "Y"), "M"),
subsets = list(TRUE, "!is.na(X) & !is.na(Y)"),
n_steps = list(6, 2))
make_data(
model,
n = 8,
nodes = list(c("X", "Y"), c("X", "M")),
subsets = list(TRUE, "is.na(X)"),
n_steps = list(3, 2))
# Example with probabilities at each step
make_data(
model,
n = 8,
nodes = list(c("X", "Y"), c("X", "M")),
subsets = list(TRUE, "is.na(X)"),
probs = list(.5, .2))
# Example with given data
make_data(model, given = "X==1 & Y==1", n = 5)
Run the code above in your browser using DataLab