Pnode.Properties | R Documentation |
"NeticaNode"
as a "Pnode"
The PNetica
package supplies the needed methods so that the
RNetica::NeticaNode
object is an instance of the
Peanut::Pnode
object. As a Pnode is nominally
parameterized, the are given the special label “pnode” to
indicate that this note has parametric information. This document
describes the extra properties of Pnode
s that are
added by PNetica
.
See NeticaNode
for a description of the Netica class.
With these methods, NeticaNode
now extends
Pnode
.
All reference classes extend and inherit methods from
"envRefClass"
.
All methods are implementations of generic functions in the
Peanut
package.
These methods are related to the parameteric information which makes a
node a Pnode
. To inidcate that a node has this
extra information, it should have the “"pnode"” label. The
functions Pnode
and
as.Pnode
will do this.
signature(node =
"NeticaNode", lnAlphas, betas, rules = "Compensatory", link =
"partialCredit", Q = TRUE, linkScale = NULL, priorWeight = NULL)
:
This function forces a NeticaNode
into a
Pnode
by initializing the Pnode-specific fields.
signature(node = NeticaNode)
:
Returns the log of discrimination parameters associated with the
node.
signature(node = NeticaNode)
:
Sets the log of discrimination parameters associated with the
node.
signature(node = NeticaNode)
:
Returns the difficulty parameters associated with the
node.
signature(node = NeticaNode)
:
Sets the difficulty parameters associated with the
node.
signature(node = NeticaNode)
:
Returns the local Q matrix associated with the
node.
signature(node = NeticaNode)
:
Sets the local Q matrix associated with the
node.
signature(node = NeticaNode)
:
Returns the names of the combination rules associated with the
node.
signature(node = NeticaNode)
:
Sets the names of the combination rules associated with the
node.
signature(node = NeticaNode)
:
Returns the link function associated with the
node.
signature(node = NeticaNode)
:
Sets the link function associated with the
node.
signature(node = NeticaNode)
:
Returns the link function scale parameter associated with the
node.
signature(node = NeticaNode)
:
Sets the link function scale parameter associated with the
node.
signature(node = NeticaNode)
:
Returns the weight or weights assigned to prior information
associated with the node.
signature(node = NeticaNode)
:
Sets the weight or weights assigned to prior information
associated with the node.
signature(node = NeticaNode)
:
Returns the combined prior and data weights
associated with the node.
signature(x = NeticaNode)
:
Forces x
to be a Pnode
; in particular,
it adds the lable "pnode".
signature(x = NeticaNode)
:
Returns true if the node has the special label "pnode".
Documentation for other methods of the Pnode
generic functions for NeticaNode
objects can be
found in the documentation objects Pnode.NeticaNode and
Pnode.States.
The “Pnode properies”,
lnAlphas
, betas
, Q
, rules
, link
,
linkScale
, and priorWeight
are stored in user fields
(NodeUserObj
) of the Netica node. A
NeticaNode
object which has those fields behaves
as a Pnode
and is suitable for the use with
Peanut
. The function
Pnode
will add default values for these fields if they are not
set.
To mark a node as a Pnode
, it is added to the
node set “pnode”. The is.Pnode
function checks for this method.
Russell Almond
Other methods of this class Pnode.NeticaNode
,
Pnode.Properties
.
Base class: NeticaNode
.
Mixin class: Pnode
.
Generic functions from Peanut
package:
PnodeLnAlphas
,
PnodeBetas
,
PnodeQ
,
PnodeRules
,
PnodeLink
,
PnodeLinkScale
,
PnodePostWeight
,
PnodePriorWeight
.
sess <- NeticaSession()
startSession(sess)
curd <- setwd(system.file("testnets",package="PNetica"))
tNet <- CreateNetwork("TestNet",sess)
## Alphas
theta1 <- NewDiscreteNode(tNet,"theta1",
c("VH","High","Mid","Low","VL"))
PnodeStateValues(theta1) <- effectiveThetas(PnodeNumStates(theta1))
PnodeProbs(theta1) <- rep(1/PnodeNumStates(theta1),PnodeNumStates(theta1))
theta2 <- NewDiscreteNode(tNet,"theta2",
c("VH","High","Mid","Low","VL"))
PnodeStateValues(theta2) <- effectiveThetas(PnodeNumStates(theta2))
PnodeProbs(theta2) <- rep(1/PnodeNumStates(theta1),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")
PnodePriorWeight(partial3) <- 10
BuildTable(partial3)
## slopes of 1 for both transitions
PnodeLnAlphas(partial3) <- c(0,0)
BuildTable(partial3)
## log slope 0 = slope 1
stopifnot(
all(abs(PnodeAlphas(partial3) -1) <.0001)
)
## Make Skill 1 more important than Skill 2
PnodeLnAlphas(partial3) <- c(.25,-.25)
BuildTable(partial3)
## increasing intercepts for both transitions
PnodeLink(partial3) <- "gradedResponse"
PnodeBetas(partial3) <- list(FullCredit=1,PartialCredit=0)
BuildTable(partial3)
stopifnot(
all(abs(do.call("c",PnodeBetas(partial3)) -c(1,0) ) <.0001)
)
## increasing intercepts for both transitions
PnodeLink(partial3) <- "partialCredit"
## Full Credit is still rarer than partial credit under the partial
## credit model
PnodeBetas(partial3) <- list(FullCredit=0,PartialCredit=0)
BuildTable(partial3)
stopifnot(
all(abs(do.call("c",PnodeBetas(partial3)) -c(0,0) ) <.0001)
)
## Make Skill 1 more important for the transition to ParitalCredit
## And Skill 2 more important for the transition to FullCredit
PnodeLnAlphas(partial3) <- list(FullCredit=c(-.25,.25),
PartialCredit=c(.25,-.25))
BuildTable(partial3)
## Set up so that first skill only needed for first transition, second
## skill for second transition; Adjust alphas to match
PnodeQ(partial3) <- matrix(c(TRUE,TRUE,
TRUE,FALSE), 2,2, byrow=TRUE)
PnodeLnAlphas(partial3) <- list(FullCredit=c(-.25,.25),
PartialCredit=0)
BuildTable(partial3)
## Using OffsetConjunctive rule requires single slope
PnodeRules(partial3) <- "OffsetConjunctive"
## Single slope parameter for each transition
PnodeLnAlphas(partial3) <- 0
PnodeQ(partial3) <- TRUE
PnodeBetas(partial3) <- c(0,1)
BuildTable(partial3)
## Make Skill 1 more important for the transition to ParitalCredit
## And Skill 2 more important for the transition to FullCredit
PnodeLnAlphas(partial3) <- 0
PnodeBetas(partial3) <- list(FullCredit=c(-.25,.25),
PartialCredit=c(.25,-.25))
BuildTable(partial3)
## Separate slope parameter for each transition;
## Note this will only different from the previous transition when
## mapDPC is called. In the former case, it will learn a single slope
## parameter, in the latter, it will learn a different slope for each
## transition.
PnodeLnAlphas(partial3) <- list(0,0)
BuildTable(partial3)
## Set up so that first skill only needed for first transition, second
## skill for second transition; Adjust betas to match
PnodeQ(partial3) <- matrix(c(TRUE,TRUE,
TRUE,FALSE), 2,2, byrow=TRUE)
PnodeBetas(partial3) <- list(FullCredit=c(-.25,.25),
PartialCredit=0)
BuildTable(partial3)
## Can also do this with special parameter values
PnodeQ(partial3) <- TRUE
PnodeBetas(partial3) <- list(FullCredit=c(-.25,.25),
PartialCredit=c(0,Inf))
BuildTable(partial3)
## The normal link function is the only one which takes a scale parameter
PnodeLink(partial3) <- "normalLink"
PnodeLinkScale(partial3) <- 1.0
PnodeLnAlphas(partial3) <- 0
PnodeBetas(partial3) <- c(0,1)
BuildTable(partial3)
stopifnot(
all(abs(PnodeLinkScale(partial3)-1)<.0001)
)
DeleteNetwork(tNet)
stopSession(sess)
setwd(curd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.