fit.bnet: Fit a bnet object

Description Usage Arguments Value Examples

Description

Fit a bnet object

Usage

1
fit.bnet(object, data, nodes = NULL, Mins = NULL, Maxs = NULL, ...)

Arguments

object

a bnet obejct

data

data.frame with names that include the variables of object

...

additional parameters to be passed to the bmop fitting functions

search

logical, use penalized loglik search or not

Value

a bnet object with fitted densities and conditional densities

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: require(bnlearn)
data(gaussian.test)
bn<-hc(gaussian.test,maxp=2)
plot(bn)
bnet<-as.bnet(bn)
plot(bnet)
is.fitted.bnet(bnet)
bnet<-fit.bnet(bnet,gaussian.test[1:100,]) # just 100 observation
 are used to make computation lighter
is.fitted.bnet(bnet)
plot(bnet$variables$A$prob)
plot(bnet$variables$B$prob)
## End(Not run)
X<-rnorm(100)
Y<-rnorm(100)
U<-rnorm(100,mean=X+Y)
V<-rnorm(100,mean=X)
Z<-rnorm(100,mean=U)
data<-data.frame(X,Y,U,V,Z)
mat<-matrix(nrow=5, c(0,0,1,1,0,
                     0,0,1,0,0,
                     0,0,0,0,1,
                     0,0,0,0,0))
bnet<-new_bnet(names(data),mat)
bnet<-fit.bnet(bnet,data)

gherardovarando/Rbnet documentation built on May 17, 2019, 4:18 a.m.