| OffsetGadget | R Documentation |
These functions open a shiny application (in a browser window or other
location) for editing a Pnode object. To reduce the
complexity, the display assumes that PnodeLink(pnode) is
partialCredit or
gradedResponse, and that
PnodeLink(pnode) is Compensatory
(Conjunctive or Disjunctive are also possibilities, but
usually, the OffsetGadget is a better parameterization
for these rules).
MakeOffsetGadget(pnode, color = "plum")
OffsetGadget(pnode, color="plum",viewer=shiny::paneViewer())
pnode |
A |
color |
A base color to use for barcharts (see
|
viewer |
This is passed to the |
The CompensatoryGadget assumes that:
The link function is partialCredit
There is a single rule for all states, and
PnodeQ(pnode)=TRUE.
One of the multiple-b rules:
OffsetConjunctive or OffsetDisjunctive is used, so
that there is one beta for each parent.
There is either a single alpha, or one alpha for each state except the last, which is a reference state.
This is the recommended way to model conjuctive and disjunctive models (using a separate difficulty/demand for each parent).
The function MakeOffsetGadget returns a list of two
functions, ui and server. These are meant to be passed
to shiny::runApp to generate the actual app.
The function OffsetGadget will return the pnode
object or throw a ‘Cancel-Error’.
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.
Pnode, calcDPCFrame,
barchart.CPF
CompensatoryGadget, RegressionGadget,
DPCGadget
## Not run:
library(PNetica) ## Requires implementation
sess <- NeticaSession()
startSession(sess)
tNet <- CreateNetwork("TestNet",sess)
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))
## CompensatoryGadget
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="OffsetConjuctive", link="partialCredit")
PnodeLnAlphas(partial3) <- 0
PnodeQ(partial3) <- TRUE
PnodeBetas(partial3) <- c(0,1)
BuildTable(partial3)
PnodePriorWeight(partial3) <- 10
BuildTable(partial3)
partial3 <- OffsetGadget(partial3)
## This expression can be used inside an Rmarkdown document
gadget <- MakeOffsetGadget(partial3)
shinyApp(gadget$ui,gadget$server,options(height=2000))
DeleteNetwork(tNet)
stopSession(sess)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.