PnetPnodes | R Documentation |
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
.
PnetPnodes(net)
PnetPnodes(net) <- value
PnodeNet(node)
net |
A |
node |
A |
value |
A list of |
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.
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
.
The functions PnetPnodes
and PetPnodes<-
and
PnodeNet
are abstract generic functions, and need specific
implementations. See the
PNetica-package
for an example.
Russell Almond
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.
Pnet
, Pnode
, GetPriorWeight
,
BuildAllTables
, GEMfit
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.