PnodeParentTvals: Fetches a list of numeric variables corresponding to parent...

PnodeParentTvalsR Documentation

Fetches a list of numeric variables corresponding to parent states

Description

In constructing a conditional probability table using the discrete partial credit framework (see calcDPCTable), each state of each parent variable is mapped onto a real value called the effective theta. The function PnodeParentTvals returns a list of effective theta values for each parent variable.

Usage

PnodeParentTvals(node)

Arguments

node

A Pnode object.

Details

Following the framework laid out in Almond (2015), the function calcDPCTable calculates a conditional probability table using the following steps:

  1. Each set of parent variable states is converted to a set of continuous values called effective thetas. These are built into an array, eTheta, using expand.grid where each column represents a parent variable and each row a possible configuration of parents.

  2. For each state of the node except the last, the set of effective thetas is filtered using the local Q-matrix, PnodeQ(node) = Q. Thus, the actual effect thetas for state s is eTheta[,Q[s,]]. The value of PnodeRules(node) determines which combination function is used.

  3. For each state of the node except the last, the corresponding rule is applied to the effective thetas to get a single effective theta for each row of the table. This step is essentially calls the expression: do.call(rules[[s]], list(eThetas[,Q[s,]]), PnodeAlphas(node)[[s]], PnodeBetas(node)[[s]]).

  4. The resulting set of effective thetas are converted into conditional probabilities using the link function.

This function is responsible for the first step of this process. PnodeParentTvals(node) should return a list corresponding to the parents of node, and each element should be a numeric vector corresponding to the states of the appropriate parent variable. It is passed to expand.grid to produce the table of parent variables for each row of the CPT.

Note that in item response theory, ability (theta) values are assumed to have a unit normal distribution in the population of interest. Therefore, appropriate theta values are quantiles of the normal distribution. In particular, they should correspond to the marginal distribution of the parent variable. The function effectiveThetas produces equally spaced (wrt the normal measure) theta values (corresponding to a uniform distribution of the parent). Unequally spaced values can be produced by using appropriate values of the qnorm function, e.g. qnorm(c(.875,.5,.125)) will produce effective thetas corresponding to a marginal distribution of (0.25, 0.5, 0.25) (note that each value is in the midpoint of the interval).

Continuous variables are handled

Value

PnodeParentTvals(node) should return a list corresponding to the parents of node, and each element should be a numeric vector corresponding to the states of the appropriate parent variable. If there are no parent variables, this will be a list of no elements.

Note

The function PnodeParentTvals is an abstract generic functions, and need specific implementations. See the PNetica-package for an example.

In particular, it is probably a mistake to using different effective theta values for different parent variables in different contexts, therefor, the cleanest implementation is to associate the effective thetas with the parent variables and simply have PnodeParentTvals fetch them on demand. Thus the implementation in PNetica is simply, lapply(NodeParents(node), PnodeStateValues).

This is probably less than ideal, as the function PnodeStateValues calculates midpoints wrt Lebesque measure and not normal measure (used by effectiveTheta.

Author(s)

Russell Almond

References

Almond, R. G. (2015) An IRT-based Parameterization for Conditional Probability Tables. Paper presented at the 2015 Bayesian Application Workshop at the Uncertainty in Artificial Intelligence Conference.

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

See Also

Pnode, PnodeStateValues, PnodeStateBounds, effectiveThetas, PnodeQ, PnodeRules, PnodeLink, PnodeLnAlphas, PnodeBetas, BuildTable, maxCPTParam calcDPCTable, mapDPC expand.grid, qnorm

Examples


## Not run: 
library(PNetica) ## Requires implementation
sess <- NeticaSession()
startSession(sess)

tNet <- CreateNetwork("TestNet",session=sess)

theta1 <- NewDiscreteNode(tNet,"theta1",
                         c("VH","High","Mid","Low","VL"))
## This next function sets the effective thetas for theta1
PnodeStateValues(theta1) <- effectiveThetas(PnodeNumStates(theta1))
PnodeProbs(theta1) <- rep(1/PnodeNumStates(theta1),PnodeNumStates(theta1))
theta2 <- NewDiscreteNode(tNet,"theta2",
                         c("High","Mid","Low"))
## This next function sets the effective thetas for theta2
PnodeStateValues(theta2) <- effectiveThetas(PnodeNumStates(theta2))
PnodeProbs(theta2) <- rep(1/PnodeNumStates(theta2),PnodeNumStates(theta2))

partial3 <- NewDiscreteNode(tNet,"partial3",
                            c("FullCredit","PartialCredit","NoCredit"))
PnodeParents(partial3) <- list(theta1,theta2)

## Usual way to set rules is in constructor
partial3 <- Pnode(partial3,rules="Compensatory", link="partialCredit")

PnodeParentTvals(partial3)
do.call("expand.grid",PnodeParentTvals(partial3))


DeleteNetwork(tNet)
stopSession(sess)

## End(Not run)

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