Plotting networks with probability bars
Plot a Bayesian network as a graph whose nodes are barplots representing the marginal probability distributions of the corresponding variables. Requires the Rgraphviz and gRain packages.
graphviz.chart(x, type = "barchart", layout = "dot", draw.levels = TRUE, grid = FALSE, scale = c(0.75, 1.1), col = "black", bg = "transparent", text.col = "black", bar.col = "black", strip.bg = bg, main = NULL, sub = NULL)
x |
an object of class |
type |
a character string, the type of graph used to plot the probability
distributions in the nodes. Possible values are |
layout |
a character string, the layout argument that will be passed to
Rgraphviz. Possible values are |
draw.levels |
a boolean value, whether to print the labels of the levels of each variable. |
grid |
a boolean value, whether to draw to a reference grid for the
probability distributions. If |
scale |
a vector of two positive numbers, used by Rgraphviz to determine the size and the aspect ratio of the nodes. |
col, bg, text.col, bar.col, strip.bg |
the colours of the node border, of the barchart background, of the text, of the bars and of the strip background. |
main |
a character string, the main title of the graph. It's plotted at the top of the graph. |
sub |
a character string, a subtitle which is plotted at the bottom of the graph. |
graphviz.chart()
invisibly returns NULL
.
Marco Scutari
## Not run: modelstring = paste("[HIST|LVF][CVP|LVV][PCWP|LVV][HYP][LVV|HYP:LVF][LVF]", "[STKV|HYP:LVF][ERLO][HRBP|ERLO:HR][HREK|ERCA:HR][ERCA][HRSA|ERCA:HR][ANES]", "[APL][TPR|APL][ECO2|ACO2:VLNG][KINK][MINV|INT:VLNG][FIO2][PVS|FIO2:VALV]", "[SAO2|PVS:SHNT][PAP|PMB][PMB][SHNT|INT:PMB][INT][PRSS|INT:KINK:VTUB][DISC]", "[MVS][VMCH|MVS][VTUB|DISC:VMCH][VLNG|INT:KINK:VTUB][VALV|INT:VLNG][ACO2|VALV]", "[CCHL|ACO2:ANES:SAO2:TPR][HR|CCHL][CO|HR:STKV][BP|CO:TPR]", sep = "") dag = model2network(modelstring) fitted = bn.fit(dag, alarm) # Netica style. graphviz.chart(fitted, grid = TRUE, bg = "beige", bar.col = "black") # Hugin style. graphviz.chart(fitted, type = "barprob", grid = TRUE, bar.col = "green", strip.bg = "lightyellow") # GeNIe style. graphviz.chart(fitted, col = "darkblue", bg = "azure", bar.col = "darkblue") # personal favourites. graphviz.chart(fitted, type = "barprob", grid = TRUE, bar.col = "darkgreen", strip.bg = "lightskyblue") graphviz.chart(fitted, type = "barprob", grid = TRUE, bar.col = "gold", strip.bg = "lightskyblue") # dot-plot version. graphviz.chart(fitted, type = "dotplot") ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.