graph = dag_create() %>%
dag_node("Get Card","y",
rhs = bernoulli(theta),
data = carModelDF$getCard) %>%
dag_node(descr = "Card Probability by Car",label = "theta",
rhs = beta(2,2),
child = "y") %>%
dag_node("Car Model","x",
data = carModelDF$carModel,
child = "y") %>%
dag_plate("Car Model","x",
data = carModelDF$carModel,
nodeLabels = "theta")
graph %>% dag_render()
numpyroCode = graph %>% dag_numpyro(mcmc=FALSE)
if (FALSE) {
## default functionality returns a data frame
# below requires numpyro installation
drawsDF = graph %>% dag_numpyro()
drawsDF %>% dagp_plot()
}
Run the code above in your browser using DataLab