Description Usage Arguments Details Author(s) Examples
Functions for defining and manipulating evidence.
1 2 3 4 5 6 7 8 9 10 | new_ev(evi.list = NULL, levels)
is.null_ev(object)
## S3 method for class 'grain_ev'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
setdiff_ev(ev1, ev2)
union_ev(ev1, ev2)
|
evi.list |
A named list with evidence; see 'examples' below. |
levels |
A named list with the levels of all variables. |
object |
Some R object. |
x |
An evidence object. |
row.names |
Not used. |
optional |
Not used. |
... |
Not used. |
ev1, ev2 |
Evidence. |
Evidence is specified as a list. Internally, evidence is represented as a grain evidence object which is a list with 4 elements.
Søren Højsgaard, sorenh@math.aau.dk
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 26 27 28 29 30 31 32 33 34 35 36 | ## Define the universe
uni <- list(asia = c("yes", "no"), tub = c("yes", "no"), smoke = c("yes", "no"),
lung = c("yes", "no"), bronc = c("yes", "no"), either = c("yes", "no"),
xray = c("yes", "no"), dysp = c("yes", "no"))
e1 <- list(dysp="no", xray="no")
eo1 <- new_ev( e1, levels=uni )
eo1
as.data.frame( eo1 )
eo1 %>% str
e1.2 <- list(dysp="no", xray=c(0, 1))
eo1.2 <- new_ev( e1.2, levels=uni )
eo1.2
# Notice that in eo1.2, xray is not regarded as hard
# evidence but as a weight on each level. Other than that, eo1.2
# and eo1 are equivalent here. This is used in connection
# with specifying likelihood evidence.
e2 <- list(dysp="yes", asia="yes")
eo2 <- new_ev(e2, uni)
# If evidence 'e1' is already set in the network and new evidence
# 'e2' emerges, the evidence in the network must be updated. But
# there is a conflict in that dysp="yes" in 'e1' and
# dysp="no" in 'e2'. The (arbitrary) convention is that
# existsting evidence overrides new evidence so that the only new
# evidence in 'e2' is really asia="yes".
# To subtract existing evidence from new evidence we can do:
setdiff_ev( eo2, eo1 )
# Likewise the 'union' is
union_ev( eo2, eo1 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.