NodeExpectedValue {RNetica}R Documentation

Calculates expected value for a numeric node

Description

Calculates the expected value for node based on the current beliefs about the nodes states. The node should either be continuous or a discrete node with levels assigned to the values. The standard deviation is supplied as an attribute.

Usage

NodeExpectedValue(node)

Arguments

node

An active NeticaNode object that references the node. The node should be continuous or have a numeric value associated with each level (see NodeLevels).

Value

Returns a scalar real giving the expected value for node. It has an attribute called "std_dev" which contains the standard deviation.

Author(s)

Russell Almond

References

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

See Also

NodeBeliefs(), NodeLevels(), NodeLevels(),is.continuous() NodeValue(),CalcNodeValue(),

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

## Prior should have mean 0, Std 1.095
stopifnot(abs(NodeExpectedValue(irt5.theta)) <.000001)
stopifnot(abs(attr(NodeExpectedValue(irt5.theta),"std_dev")-1.095445)<.00001)

NodeFinding(irt5.x[[1]]) <- "Right"
## Expected value should go up
stopifnot(NodeExpectedValue(irt5.theta)>0)

DeleteNetwork(irt5)
stopSession(sess)


[Package RNetica version 0.7-3 Index]