bn.fit {bnlearn}R Documentation

Fit the parameters of a Bayesian network

Description

Fit the parameters of a Bayesian network conditional on its structure.

Usage

bn.fit(x, data, debug = FALSE)

Arguments

x an object of class bn.
data a data frame, containing the variables in the model.
debug a boolean value. If TRUE a lot of debugging output is printed; otherwise the function is completely silent.

Value

An object of class bn.fit. See bn.fit class for details.

Note

Due to the way Bayesian networks are defined it's possible to estimate their parameters only if the network structure is completely directed (i.e. there are no undirected arcs). See set.arc and pdag2dag for two ways of manually setting the direction of one or more arcs.

Author(s)

Marco Scutari

Examples

data(learning.test)

# learn the network structure.
res = gs(learning.test)
# set the direction of the only undirected arc, A - B.
res = set.arc(res, "A", "B")
# estimate the parameters of the Bayesian network.
fitted = bn.fit(res, learning.test)

[Package bnlearn version 1.7 Index]