set.finding {gRaven} | R Documentation |
Set, retract and inspect findings
Description
Set, retract and inspect findings
Usage
set.finding(domain, node, finding)
retract(domain, nodes=domain$nodes)
get.finding(domain, nodes=domain$nodes, type = c("entered", "propagated"),
namestates=FALSE)
Arguments
domain |
name of gRaven domain |
node |
name of node |
nodes |
character vector naming one or mode nodes |
finding |
either a state of node |
type |
character vector of one or more options to select between evidence entered before or after most recent propagation |
namestates |
logical, should output have the states labelled |
Details
For type
, partial matching is used.
Value
For set.finding
and retract
, a NULL value is invisibly returned. For get.finding
, the likelihood vector is invisibly returned for each specified node, in a format governed by namestates
. This is a named vector in the case of a single node, otherwise a list of such vectors. For a single node, in the absence of any evidence, a named vectors of 1's is returned.
Differences from RHugin
Findings (or evidence) are handled differently in gRaven
(and gRain
) than in RHugin
, and that is reflected in differences in results from these functions, especially get.finding
. For set.finding
in gRaven
, the case
argument is not supported. For get.finding
in both packages, previously-set evidence is displayed as a non-negative vector indexed by the states, typically a probability distribution; two enhancements in gRaven
are that findings on more than one node can be displayed, and that the format of the output can be controlled by namestates
. In gRaven
when new evidence is set by set.finding
, it replaces any existing evidence on the same node, and all existing evidence on all nodes is "unpropagated". Evidence is held in a data structure cache
until propagation, when it is moved to evid
; these names are used in labelling the output from get.finding
. Finally if no evidence has been entered on a node, RHugin
reports a vector of all ones, while gRaven
returns such a vector invisibly.
Author(s)
Peter J. Green, P.J.Green@bristol.ac.uk
Examples
demo(chest,package="gRaven",echo=FALSE)
chest
set.finding(chest,"asia","yes")
set.finding(chest,"dysp","no")
propagate(chest)
get.belief(chest,"asia")
get.belief(chest,"tub")
get.finding(chest)
retract(chest,"dysp")
get.belief(chest,"tub")
get.finding(chest)