pctree | R Documentation |
Recursive partitioning (also known as trees) based on partial credit models.
pctree(formula, data, na.action, nullcats = c("keep", "downcode", "ignore"),
reltol = 1e-10, deriv = c("sum", "diff"), maxit = 100L, ...)
## S3 method for class 'pctree'
predict(object, newdata = NULL,
type = c("probability", "cumprobability", "mode", "median", "mean",
"category-information", "item-information", "test-information", "node"),
personpar = 0, ...)
## S3 method for class 'pctree'
plot(x, type = c("regions", "profile"), terminal_panel = NULL,
tp_args = list(...), tnex = 2L, drop_terminal = TRUE, ...)
formula |
A symbolic description of the model to be fit. This
should be of type |
data |
a data frame containing the variables in the model. |
na.action |
a function which indicates what should happen when the data
contain missing values ( |
nullcats |
character. How null categories should be treated. See
|
deriv |
character. If "sum" (the default), the first derivatives of the elementary symmetric functions are calculated with the sum algorithm. Otherwise ("diff") the difference algorithm (faster but numerically unstable) is used. |
reltol , maxit |
arguments passed via |
... |
arguments passed to the underlying functions, i.e., to
|
object , x |
an object of class |
newdata |
optional data frame with partitioning variables for which predictions should be computed. By default the learning data set is used. |
type |
character specifying the type of predictions or plot. For the
|
personpar |
numeric person parameter (of length 1) at which the predictions are evaluated. |
terminal_panel , tp_args , tnex , drop_terminal |
arguments passed to
|
Partial credit trees are an application of model-based recursive partitioning
(implemented in mob
) to partial credit models
(implemented in pcmodel
).
Various methods are provided for "pctree"
objects, most of them
inherit their behavior from "modelparty"
objects (e.g., print
, summary
,
etc.). For the PCMs in the nodes of a tree, coef
extracts all item and threshold
parameters except those restricted to be zero. itempar
and threshpar
extract all item and threshold parameters (including the restricted ones).
The plot
method by default employs the node_regionplot
panel-generating function and the node_profileplot
panel-generating
function is provided as an alternative.
An object of S3 class "pctree"
inheriting from class "modelparty"
.
Komboz B, Zeileis A, Strobl C (2018). Tree-Based Global Model Tests for Polytomous Rasch Models. Educational and Psychological Measurement, 78(1), 128–166. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1177/0013164416664394")}
mob
, pcmodel
,
rstree
, raschtree
o <- options(digits = 4)
## verbal aggression data from package psychotools
data("VerbalAggression", package = "psychotools")
## use response to the second other-to-blame situation (train)
VerbalAggression$s2 <- VerbalAggression$resp[, 7:12]
## exclude subjects who only scored in the highest or the lowest categories
VerbalAggression <- subset(VerbalAggression, rowSums(s2) > 0 & rowSums(s2) < 12)
## fit partial credit tree model
pct <- pctree(s2 ~ anger + gender, data = VerbalAggression)
## print tree (with and without parameters)
print(pct)
print(pct, FUN = function(x) " *")
## show summary for terminal panel nodes
summary(pct)
## visualization
plot(pct, type = "regions")
plot(pct, type = "profile")
## extract item and threshold parameters
coef(pct)
itempar(pct)
threshpar(pct)
## inspect parameter stability tests in the splitting node
if(require("strucchange")) sctest(pct, node = 1)
options(digits = o$digits)
## partial credit tree on artificial data from Komboz et al. (2018)
data("DIFSimPC", package = "psychotree")
pct2 <- pctree(resp ~ gender + age + motivation, data = DIFSimPC)
plot(pct2, ylim = c(-4.5, 4.5), names = paste("I", 1:8))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.