Skip to Main Content
Bayesian Networks
book

Bayesian Networks

by Marco Scutari, Jean-Baptiste Denis
June 2014
Intermediate to advanced content levelIntermediate to advanced
241 pages
6h 20m
English
CRC Press
Content preview from Bayesian Networks
70 Bayesian Networks: With Examples in R
> dimnames(dsd) <- list(D = c("thin", "average", "thick"),
+ S = c("s1", "s2"))
> dsd
S
D s1 s2
thin 0.88493 0.03593
average 0.07914 0.07914
thick 0.03593 0.88493
Subsequently, we compute the joint distribution of D and S by multiplying dsd
by the probability of each S, which we stored in sp when we loaded the JAGS
model.
> jointd <- dsd * sp
Finally, we compute the conditional probability of S given D by dividing each
row by its total, which we compute using rowSums, and by transposing the
resulting matrix with the t function.
> dds <- t(jointd / rowSums(jointd))
> dds
D
S thin average thick
s1 0.96098 0.5 0.03902
s2 0.03902 0.5 0.96098
Using rjags, we can assess the probability of each supplier using either
the contin
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Applications of Bayesian Reliability

Practical Applications of Bayesian Reliability

Yan Liu, Athula I. Abeyratne
Benefits of Bayesian Network Models

Benefits of Bayesian Network Models

Philippe Weber, Christophe Simon
Learning Bayesian Models with R

Learning Bayesian Models with R

Hari Manassery Koduvely

Publisher Resources

ISBN: 9781482225587