drawnetwork
allows the user to specify a Bayesian network through a point and click interface.
drawnetwork(nw,df,prior,trylist=vector("list",size(nw)),
unitscale=20,cexscale=8,
arrowlength=.25,nocalc=FALSE,
yr=c(0,350),xr=yr,...)
A list with two elements that may be accessed using
getnetwork
and gettrylist
. The elements are
an object of class network
with the final network.
an updated list used internally for reusing learning
of nodes, see maketrylist
.
an object of class network
to be edited.
a data frame used for learning the network, see
network
.
a list containing parameter priors, generated by
jointprior
.
a list used internally for reusing learning of nodes,
see maketrylist
.
a numeric passed to the plot method for network objects. Measures the scaled size of text and symbols.
a numeric passed to the plot method for network objects. Measures the length of the edges of the arrowheads.
a logical. If TRUE
, no learning procedure is called, see eg. rnetwork
.
a numeric passed to the plot method for network objects. Scale parameter for chopping off arrow heads.
a numeric vector with two components containing the range on x-axis.
a numeric vector with two components containing the range on y-axis.
additional plot arguments, passed to the plot method for network objects.
Susanne Gammelgaard Bottcher,
Claus Dethlefsen rpackage.deal@gmail.com.
To insert an arrow from node 'A' to node 'B', first click node 'A' and then click node 'B'. When the graph is finished, click 'stop'.
To specify that an arrow must not be present, press 'ban' (a toggle)
and draw the arrow. This is shown as a red dashed arrow. It is possible
to ban both directions between nodes. The ban list is stored with the
network in the property banlist
. It is a matrix with two
columns. Each row is the 'from' node index and the 'to' node index,
where the indices are the column number in the data frame.
Note that the network score changes as the network is re-learned
whenever a change is made (unless nocalc
is TRUE
).
network
data(rats)
rats.nw <- network(rats)
rats.prior <- jointprior(rats.nw,12)
rats.nw <- getnetwork(learn(rats.nw,rats,rats.prior))
if (FALSE) newrat <- getnetwork(drawnetwork(rats.nw,rats,rats.prior))
Run the code above in your browser using DataLab