Biology Reference
In-Depth Information
When using bnlearn , parameter learning is performed by the bn.fit function,
which takes the network structure and the data as parameters. Since marks is a con-
tinuous data set, the parameters take the form of regression coefficients as indicated
in Sect. 2.2.4 . Their maximum likelihood estimates can be computed as follows.
Only a single node is shown for brevity:
> fitted = bn.fit(bn.gs, data = marks)
> fitted$ALG
Parameters of node ALG (Gaussian distribution)
Conditional density: ALG | ANL + STAT
Coefficients:
(Intercept) ANL STAT
24.7254768 0.3482454 0.2273881
Standard deviation of the residuals: 6.791987
In general, we can specify which estimator will be used via the method argu-
ment, which can be set either to “ mle ” (for the maximum likelihood estimator) or
bayes ” (for the posterior Bayesian estimator arising from a flat, non-informative
prior). Only the former is available for continuous data.
Once we have a bn.fit object, we can modify any local distribution with the
usual replacement operators. In the case of Gaussian Bayesian networks, the new
parameters should be specified in a list containing at least a complete set of regres-
sion coefficients ( coef ) and the standard deviation of the residuals ( sd ).
> fitted$ALG = list(coef = c("(Intercept)" = 25,
+
"ANL" = 0.5, "STAT" = 0.25), sd = 6.5)
> fitted$ALG
Parameters of node ALG (Gaussian distribution)
Conditional density: ALG | ANL + STAT
Coefficients:
(Intercept) ANL STAT
25.00 0.50 0.25
Standard deviation of the residuals: 6.5
New sets of fitted values ( fitted ) and residuals ( resid ) can also be included in
the assignment.
In addition, we can create a bn.fit object from scratch using the custom.fit
function and specifying the parameters with same syntax used above.
> MECH.par = list(coef = c("(Intercept)" = -10,
+ "VECT" = 0.5, "ALG" = 0.6), sd = 13)
> VECT.par = list(coef = c("(Intercept)" = 10,
Search WWH ::




Custom Search