PnetPnodes: Returns a list of Pnodes associated with a Pnet

PnetPnodesR Documentation

Returns a list of Pnodes associated with a Pnet

Description

Each Pnet object maintains a list of Pnode objects which it is intended to set. The function PnetPnodes accesses this list. The function PnodeNet returns a back pointer to the Pnet from the Pnode.

Usage

PnetPnodes(net)
PnetPnodes(net) <- value
PnodeNet(node)

Arguments

net

A Pnet object.

node

A Pnode object.

value

A list of Pnode objects associated with net.

Details

The primary purpose of PnetPnodes is to provide a list of nodes which GEMfit and BuildAllTables will iterate to do their function.

The function PnodeNet returns the network object associated with the node (this assumes that the implementation has back pointers). Note that node may not be in the result of PnetPnodes (if for example, the conditional probability table of node is to remain fixed during a call to GEMfit). This function is used by GetPriorWeight to get the default prior weight if node does not have that value set locally.

Value

The function PnetPnodes returns a list of Pnode objects associated with the net. The expression PnetPnodes(net) <- value returns the net.

The function PnodeNet returns the network (Pnet) object that contains node.

Note

The functions PnetPnodes and PetPnodes<- and PnodeNet are abstract generic functions, and need specific implementations. See the PNetica-package for an example.

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.

See Also

Pnet, Pnode, GetPriorWeight, BuildAllTables, GEMfit

Examples


 ## Not run: 

library(PNetica)  ## Implementation of Peanut protocol
sess <- NeticaSession()
startSession(sess)
## Create network structure using RNetica calls
IRT10.2PL <- CreateNetwork("IRT10_2PL",session=sess)

theta <- NewDiscreteNode(IRT10.2PL,"theta",
                         c("VH","High","Mid","Low","VL"))
PnodeStateValues(theta) <- effectiveThetas(PnodeNumStates(theta))
NodeProbs(theta) <- rep(1/PnodeNumStates(theta),PnodeNumStates(theta))

J <- 10 ## Number of items
items <- NewDiscreteNode(IRT10.2PL,paste("item",1:J,sep=""),
                         c("Correct","Incorrect"))
for (j in 1:J) {
  PnodeParents(items[[j]]) <- list(theta)
  PnodeStateValues(items[[j]]) <- c(1,0)
  PnodeLabels(items[[j]]) <- c("observables")
}
## Convert into a Pnet
IRT10.2PL <- Pnet(IRT10.2PL,priorWeight=10,pnode=items[2:J])
for (j in 2:J) {
  items[[j]] <- Pnode(items[[j]])
}

stopifnot(
  length(PnetPnodes(IRT10.2PL)) == J-1, # All except item 1
  PnodeNet(items[[2]]) == IRT10.2PL, 
  PnodeNet(items[[1]]) == IRT10.2PL # this is net membership, not
                                     # Pnodes field
)

PnetPnodes(IRT10.2PL) <- items ## Add back item 1
stopifnot(
  length(PnetPnodes(IRT10.2PL)) == J
)
DeleteNetwork(IRT10.2PL)
stopSession(sess)

## End(Not run)

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