Description Usage Arguments Value Examples

Given a graph object of class `causact_graph`

, create collections of nodes that should be repeated i.e. represent multiple instances of a random variable, random vector, or random matrix. When nodes are on more than one plate, graph rendering will treat each unique combination of plates as separate plates.

1 2 3 4 5 6 7 8 9 |

`graph` |
a graph object of class |

`descr` |
a longer more descriptive label for the cluster/plate. |

`label` |
a short character string to use as an index. |

`nodeLabels` |
a character vector of node labels or descriptions to include in the list of nodes. |

`data` |
a vector representing the categorical data whose unique values become the plate index. To use with |

`addDataNode` |
a logical value. When |

`rhs` |
Optional |

an expansion of the input `causact_graph`

object with an added plate representing the repetition of `nodeLabels`

for each unique value of `data`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | ```
# single plate example
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()
# multiple plate example
library(dplyr)
poolTimeGymDF = gymDF %>%
mutate(stretchType = ifelse(yogaStretch == 1,
"Yoga Stretch",
"Traditional")) %>%
group_by(gymID,stretchType,yogaStretch) %>%
summarize(nTrialCustomers = sum(nTrialCustomers),
nSigned = sum(nSigned))
graph = dag_create() %>%
dag_node("Cust Signed","k",
rhs = binomial(n,p),
data = poolTimeGymDF$nSigned) %>%
dag_node("Probability of Signing","p",
rhs = beta(2,2),
child = "k") %>%
dag_node("Trial Size","n",
data = poolTimeGymDF$nTrialCustomers,
child = "k") %>%
dag_plate("Yoga Stretch","x",
nodeLabels = c("p"),
data = poolTimeGymDF$stretchType,
addDataNode = TRUE) %>%
dag_plate("Observation","i",
nodeLabels = c("x","k","n")) %>%
dag_plate("Gym","j",
nodeLabels = "p",
data = poolTimeGymDF$gymID,
addDataNode = TRUE)
graph %>% dag_render()
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.