make_model(statement = "X -> Y")
modelXKY <- make_model("X -> K -> Y; X -> Y")
# Example where cyclicaly dag attempted
if (FALSE) {
modelXKX <- make_model("X -> K -> X")
}
# Examples with confounding
model <- make_model("X->Y; X <-> Y")
model$P
model <- make_model("Y2 <- X -> Y1; X <-> Y1; X <-> Y2")
dim(model$P)
model$P
model <- make_model("X1 -> Y <- X2; X1 <-> Y; X2 <-> Y")
dim(model$P)
model$parameters_df
# A single node graph is also possible
model <- make_model("X")
# Unconnected nodes not allowed
if (FALSE) {
model <- make_model("X <-> Y")
}
nodal_types <-
list(
A = c("0","1"),
B = c("0","1"),
C = c("0","1"),
D = c("0","1"),
E = c("0","1"),
Y = c(
"00000000000000000000000000000000",
"01010101010101010101010101010101",
"00110011001100110011001100110011",
"00001111000011110000111100001111",
"00000000111111110000000011111111",
"00000000000000001111111111111111",
"11111111111111111111111111111111" ))
make_model("A -> Y; B ->Y; C->Y; D->Y; E->Y",
nodal_types = nodal_types)$parameters_df
nodal_types = list(Y = c("01", "10"), Z = c("0", "1"))
make_model("Z -> Y", nodal_types = nodal_types)$parameters_df
make_model("Z -> Y", nodal_types = FALSE)$parents_df
Run the code above in your browser using DataLab