-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I am trying to perform a deterministic intervention on a DAG.
library(simcausal)
library(rje)
D <- DAG.empty()
D <- D +
node("U1", distr="runif"
)
D <- D +
node("U2", distr="runif"
)
D <- D +
node("UA", distr="runif"
)
D <- D +
node("UY", distr="runif"
)
D <- D +
node("W1", distr="rconst",
const = as.numeric(U1 < 0.5))
D <- D +
node("W2", distr="rconst",
const = as.numeric(U2 < 0.5))
D <- D +
node("A", distr="rconst",
const = as.numeric(UA < expit(-0.5 + W1 - 1.5 * W2)) )
D <- D +
node("Y", distr="rconst",
const = as.numeric(UY < expit(-0.75 + W1 - 2 * W2 + 2.5 * A + A*W1)),
EFU = TRUE)
setDl2 <- set.DAG(D)
# ----------------------------------------------------------------------
plotDAG(setDl2, xjitter = 0.32, yjitter = 0.03,
edge_attrs = list(width = 0.5, arrow.width = 0.4, arrow.size = 0.8),
vertex_attrs = list(size = 19, label.cex = 1.5))
title(main = "SCM graph")
# ----------------------------------------------------------------------
# intervention
actN_A <- node("A",distr="rconst", const = theta)
D_act <- D + action("A_th0", nodes=actN_A, theta=0)
D_act <- D_act + action("A_th1", nodes=actN_A, theta=1)
D_act <- D_act + action("A_no_intervene", nodes=node("A", distr="rconst", const = as.numeric(UA < expit(-0.5 + W1 - 1.5 * W2)) ))
ate.data <- simfull(A(D_act), n=1e5 , rndseed = 252)The D_act assignment fails to run under 0.5.0 while suceeds under 0.4.0. Could you please take a look when you have time?
Metadata
Metadata
Assignees
Labels
No labels