dkesada/dbnR

The naming convention for time

Closed this issue · 1 comments

Hi @dkesada
sorry for disturbing you again. I my work with the package, I found the naming convention of the time series data is _t_0 and so on; it does not matter, but are there any tricks or hints on how to change the convention to custom style in the plot produced by plot_dynamic_network. In medical research, the early time is usually named time 0;
Another question is that, can I plot marginal distribution for the dynamic bayesian model as that done in the bnlearn package : https://www.bnlearn.com/examples/graphviz-chart/

Hi @zh-zhang1984

Don't worry! It is no disturbance at all. I added a new argument reverse in the plot_network and the plot_dynamic_network functions that allows you to plot DBN networks with the classic naming convention (t_0 as the oldest and t_n as the most recent). It is in the devel branch, on 60b23a5. To download the devel version of the package, you can simply run devtools::install_github("dkesada/dbnR", ref = "devel"). With that, you should be able to plot DBNs with the proper names.

As for the marginal distribution plot, in theory it can be done, but it does not work in the original bnlearn. The graphviz.chart function is supposed to work with Gaussian networks, and it says so in the tutorial link you posted, but it is not true in reality and it throws an exception. It only works with discrete networks, and dbnR only allows continuous variables. If this function where to be fixed in bnlearn, then it could potentially be used on DBNs too, but it probably stopped working on Gaussian networks for a reason, and I do not have the time now to debug bnlearn's code and find a fix, sorry about that.