configStats: Configures the Statistic Objects for the BNEninge

View source: R/EngineGears.R

configStatsR Documentation

Configures the Statistic Objects for the BNEninge

Description

As part of the scoring cycle, the BNEngine calculates the values of certain statistics of the student model. This function sets up those statistics.

Usage

configStats(eng, statmat = data.frame())

Arguments

eng

The BNEngine to be configured.

statmat

A data frame containing the statistic descriptions, see details.

Details

A Statistic is a functional that is applied to the student model (sm) of a StudentRecord. At the end of the evidence processing cycle, the function updateStats is called to calculate new values for the specified statistics.

The statmat argument should be a data.frame with three columns (all of mode character):

Name

This column gives an identifier for the statistic used in the output message.

Fun

This column gives the name of a function (see Statistic for a list of possible values) which calculates the statistic value.

Node

This gives the name of a node in the competency model which is the focus of the statistic.

If the statmat argument is not supplied, then a default value based on the engine type is used. For the BNEngineMongo this data frame is taken from a table in the database. For the BNEngineNDB the default statmat is stored in a field in the engine.

Value

The modified engine argument is returned.

Author(s)

Russell Almond

References

Almond, Mislevy, Steinberg, Yan and Williamson (2015). Bayesian Networks in Educational Assessment. Springer. Especially Chapter 13.

See Also

Classes: BNEngine, Statistic updateStats, announceStats

Examples



## Requires PNetica
library(RNetica)  ## Must load to setup Netica DLL
app <- "ecd://epls.coe.fsu.edu/EITest"
sess <- RNetica::NeticaSession()
RNetica::startSession(sess)

config.dir <- file.path(library(help="Peanut")$path, "auxdata")
net.dir <- file.path(library(help="PNetica")$path,"testnets")

netman <- read.csv(file.path(config.dir, "Mini-PP-Nets.csv"),
                    row.names=1, stringsAsFactors=FALSE)
stattab <- read.csv(file.path(config.dir, "Mini-PP-Statistics.csv"),
                    as.is=TRUE)

Nethouse <- PNetica::BNWarehouse(netman,session=sess,
             address=net.dir)

cl <- new("CaptureListener")
listeners <- list("cl"=cl)

ls <- ListenerSet(sender= paste("EAEngine[",app,"]"),
                  db=MongoDB(noMongo=TRUE), listeners=listeners)

eng <- newBNEngineNDB(app=app,warehouse=Nethouse,
                     listenerSet=ls,manifest=netman,
                     profModel="miniPP_CM",
                     histNodes="Physics",
                     activeTest="EAActive.txt")

## Standard initialization methods.                     
configStats(eng,stattab)
stats <- eng$stats()
stopifnot(all(sapply(stats,StatName)==stattab$Name),
          all(sapply(stats,function(s) s@fun)==stattab$Fun),
          all(sapply(stats,function(s) s@node)==stattab$Node))



ralmond/EABN documentation built on Aug. 30, 2023, 12:52 p.m.