CompensatoryGadget | 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).
MakeCompensatoryGadget(pnode, color = "firebrick")
CompensatoryGadget(pnode, color="firebrick",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
or
gradedResponse
.
There is a single rule for all states, and
PnodeQ(pnode)=TRUE
.
One of the multiple-a rules:
Compensatory
, Conjunctive
or
Disjunctive
is used, so that there is one alpha for each
parent.
There is one beta for each state except the last, which is a reference state.
It is most useful for compensatory models.
The function MakeCompensatoryGadget
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 CompensatoryGadget
will return the pnode
object or throw a ‘Cancel-Error’.
Although the addition of the 'MakeCompensatoryGadget' was specifically designed to allow the embedding of the gadget in Rmarkdown shiny documents, the default Rmarkdown layout algorithms do not work properly.
Adding the following markdown code:
```{css, echo = FALSE} .shiny-frame{height: 1000px;} ```
will adjust the space allocated for the gadget to 1000 pixels, allowing for sufficient room for display.
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
OffsetGadget
, 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="Compensatory", link="partialCredit")
PnodePriorWeight(partial3) <- 10
BuildTable(partial3)
partial3 <- CompensatoryGadget(partial3)
## This expression can be used inside an Rmarkdown document
gadget <- MakeCompensatoryGadget(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.