I am currently starting to work with the r package bnlearn. I want to create some data, for this purpose I want to use some baysian networks described here.
I load a model and then I try to get the distribution for a specific node (conditional or unconditional). How can I get this information?
I am currently only seeing the graph structure of the network.
Edit: I am using the python library rpy2
import os
os.environ['R_HOME'] = r'C:\Program Files\R\R-4.3.2'
from rpy2.robjects.packages import importr
import rpy2.robjects as robjects
bnlearn = importr('bnlearn')
# loading the model
robjects.r.load('./path/to/healthcare.rda')
df = robjects.globalenv['bn']
model = bnlearn.bn_net(df)
# model has a node 'A'
# I want to do something like
# bnlearn.distribution_of(model, 'A')
I am new to programming with r, this might be awful code.
I just figured out that the probability distribution is described in the data frame (df), not the model itself.