Statistic-class: Class '"Statistic"'

Statistic-classR Documentation

Class "Statistic"

Description

A statistic is a functional that when applied to a Bayesian network returns a value. Usually, the statistic is a function of the distribution of a single node, but it could also be a function of several nodes. Statistic objets have a calcStat method, which when applied to a network, produces the value. Lists of statistics are often maintained by Bayes net engines to report values at designated times (e.g., after new evidence arrives).

Objects from the Class

Objects are created using the function Statistic(fun, node, name, ...).

Slots

name:

Object of class "character" giving an identifier for the statistic.

node:

Object of class "character" giving the name(s) of the node(s) that are referenced by the statistic. Note that these are not the actual node objects, as the network could be different at each call.

fun:

Object of class "character" giving a function to be applied to the nodes. The function should have signature(net="Pnet", node), where node could be either a Pnode or a list of Pnodes.

Methods

calcStat

signature(stat = "Statistic", net): This method (a) finds the nodes referenced in node, (b) applies fun (using do.call to net and the actual nodes.

StatName

signature(x = "Statistic"): Returns the name of the statistic.

show

signature(objet = "Statistic"): Returns a printable representation of the statistic.

Author(s)

Russell Almond

References

Almond, R.G., Mislevy, R.J. Steinberg, L.S., Yan, D. and Willamson, D. M. (2015). Bayesian Networks in Educational Assessment. Springer. Chapter 13.

See Also

Avaliable Statistic functions: PnodeMargin, PnodeEAP, PnodeSD, PnodeMedian, PnodeMode.

Constructor function: Statistic

calcStat

Examples


## Not run: 

library(PNetica) ## Need a specific implementation
sess <- NeticaSession()
startSession(sess)

irt10.base <- ReadNetworks(system.file("testnets", "IRT10.2PL.base.dne",
                           package="PNetica"), session=sess)
irt10.base <- as.Pnet(irt10.base)  ## Flag as Pnet, fields already set.
irt10.theta <- NetworkFindNode(irt10.base,"theta")
irt10.items <- PnetPnodes(irt10.base)
## Flag items as Pnodes
for (i in 1:length(irt10.items)) {
  irt10.items[[i]] <- as.Pnode(irt10.items[[i]])
  
}
## Make some statistics
marginTheta <- Statistic("PnodeMargin","theta","Pr(theta)")
meanTheta <- Statistic("PnodeEAP","theta","EAP(theta)")
sdTheta <- Statistic("PnodeSD","theta","SD(theta)")
medianTheta <- Statistic("PnodeMedian","theta","Median(theta)")
modeTheta <- Statistic("PnodeMedian","theta","Mode(theta)")


BuildAllTables(irt10.base)
CompileNetwork(irt10.base) ## Netica requirement

calcStat(marginTheta,irt10.base)
calcStat(meanTheta,irt10.base)
calcStat(sdTheta,irt10.base)
calcStat(medianTheta,irt10.base)
calcStat(modeTheta,irt10.base)

DeleteNetwork(irt10.base)
stopSession(sess)

## End(Not run)

ralmond/Peanut documentation built on Sept. 19, 2023, 8:27 a.m.