I'm trying to teach myself about Bayesian Networks and am working with the
following data and the bnlearn package.
I understand the conceptual aspects of BNs, but I'm not sure how to specify
the response variables in R when constructing
a dag plot. I've cecked ?hc and done numerous google searches without luck.

Can anyone help?

library("bnlearn")
library("Rgraphviz")

dat=data.frame(won=c(1,0,0,1,0,0), sold=c(0,0,0,1,0,0),
insured=c(0,0,1,0,0,1),
               credit=c("POOR","FAIR","GOOD","FAIR","FAIR","GOOD"))
dat$won = factor(dat$won)
dat$sold = factor(dat$sold)
dat$insured = factor(dat$insured)
dat$credit = factor(dat$credit)

highlight.opts <- list(nodes = c("won","sold","insured","credit"),
                       col = "red", fill = "grey")
bn.hc <- hc(dat, score = "aic")
graphviz.plot(bn.hc, highlight=highlight.opts)



Thanks,
Abraham


-- 
*Abraham Mathew
Statistical Analyst
www.amathew.com
720-648-0108
@abmathewks*

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to