EnterNegativeFinding {RNetica}R Documentation

Sets findings for a Netica node to a list of ruled out values.

Description

This is conceptually equivalent to setting NodeFinding(node)<-not(eliminatedVals) (although this will not work as NodeFinding does not accept set values). It essentially eliminates any of the eliminatedVals as possible values (assigns them zero probability).

Usage

EnterNegativeFinding(node, eliminatedVals)

Arguments

node

An active NeticaNode whose value was observed or hypothesized.

eliminatedVals

A character or integer vector indicating the values to be ruled out. Character values should be one of the values in NodeStates(node). Integer values should be between 1 and NodeNumStates(node) inclusive.

Details

This function essentially asserts that Pr(node \in eliminatedVals) = 0. Thus, it rules out the values in the eliminatedVals set. Note that the length of this set should be less than the number of states, or all possibilities will have been eliminated.

Note calling EngerNegativeFining(node, ...) clears any previous findings (including virtual findings set through NodeLikelihood() or simple finding set through NodeFinding(node)<-value). The function RetractNodeFinding(node) will clear the current finding without setting it to a new value.

Value

This function returns node invisibly.

Note

If SetNetworkAutoUpdate() has been set to TRUE, then this function could take some time as each finding is individually propagated. Consider wrapping multiple calls setting NodeFinding() in WithoutAutoUpdate(net, ...).

Unlike the Netica function EnterFindingNot_bn() the function EnterNegativeFinding() internally calls RetractFindings. So there is no need to do this manually. Also, the internal Netica function multiplies multiple calls to EnterFindingNod_bn() add to the list of negative findings, while in the R version takes the entire list.

Author(s)

Russell Almond

References

http://norsys.com/onLineAPIManual/index.html: EnterFindingNot_bn()

See Also

NeticaBN, NodeBeliefs(), NodeFinding(), RetractNodeFinding(), NodeLikelihood()

Examples

sess <- NeticaSession()
startSession(sess)
irt5 <- ReadNetworks(file.path(library(help="RNetica")$path,
                           "sampleNets","IRT5.dne"), session=sess)

irt5.theta <- NetworkFindNode(irt5,"Theta")
irt5.x <- NetworkFindNode(irt5,paste("Item",1:5,sep="_"))

CompileNetwork(irt5) ## Ready to enter findings

## Calculated new expected beliefs
renormed <- NodeProbs(irt5.theta)
renormed[c("neg1","neg2")] <- 0
renormed <- renormed/sum(renormed)

## Negative finding
EnterNegativeFinding(irt5.theta,c("neg1","neg2")) ## Rule out negatives.
stopifnot(
  NodeFinding(irt5.theta) == "@NEGATIVE FINDINGS",
  sum(abs(NodeLikelihood(irt5.theta) - c(1,1,1,0,0))) < 1e-6,
  sum(abs(NodeBeliefs(irt5.theta) - renormed)) < 1.e-6
)


DeleteNetwork(irt5)
stopSession(sess)


[Package RNetica version 0.8-2 Index]