Partial Credit Trees

Description

Recursive partitioning (also known as trees) based on partial credit models.

Usage

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, ...)

Arguments

formula A symbolic description of the model to be fit. This should be of type y ~ x1 + x2 where y should be a matrix with items in the columns and observations in the rows and x1 and x2 are used as partitioning variables.
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 (NAs).
nullcats character. How null categories should be treated. See pcmodel for details.
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 pcmodel to optim.
arguments passed to the underlying functions, i.e., to mob_control for pctree, and to the underlying predict and plot methods, respectively.
object, x an object of class “raschtree”.
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 predict method, either just the ID of the terminal “node” can be predicted or some property of the model at a given person parameter (specified by personpar).
personpar numeric person parameter (of length 1) at which the predictions are evaluated.
terminal_panel, tp_args, tnex, drop_terminal arguments passed to plot.modelparty/plot.party.

Details

Partial credit trees are an application of model-based recursive partitioning (implemented in mob) to partial credit models (implemented in pcmodel). See Komboz et al. (2018) for a detailed discussion. For technical and algorithmic details, see the documentation of the two core functions linked above as well as vignette(“mob”, package = “partykit”).

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.

Value

An object of S3 class “pctree” inheriting from class “modelparty”.

References

Komboz B, Zeileis A, Strobl C (2018). Tree-Based Global Model Tests for Polytomous Rasch Models. Educational and Psychological Measurement, 78(1), 128–166. doi:10.1177/0013164416664394

See Also

mob, pcmodel, rstree, raschtree

Examples

library("psychotree")

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)
Partial credit tree

Model formula:
s2 ~ anger + gender

Fitted party:
[1] root
|   [2] gender in female: n = 220
|       s2S2WantCurse-C2   s2S2DoCurse-C1   s2S2DoCurse-C2 s2S2WantScold-C1 
|                  1.486            1.169            3.239            1.097 
|       s2S2WantScold-C2   s2S2DoScold-C1   s2S2DoScold-C2 s2S2WantShout-C1 
|                  2.903            2.006            4.791            1.618 
|       s2S2WantShout-C2   s2S2DoShout-C1   s2S2DoShout-C2 
|                  3.768            3.198            6.705 
|   [3] gender in male: n = 67
|       s2S2WantCurse-C2   s2S2DoCurse-C1   s2S2DoCurse-C2 s2S2WantScold-C1 
|                 0.5547          -0.2179          -0.1240           0.8065 
|       s2S2WantScold-C2   s2S2DoScold-C1   s2S2DoScold-C2 s2S2WantShout-C1 
|                 1.7020           0.2919           1.7719           1.5697 
|       s2S2WantShout-C2   s2S2DoShout-C1   s2S2DoShout-C2 
|                 3.6675           2.1006           5.4388 

Number of inner nodes:    1
Number of terminal nodes: 2
Number of parameters per node: 11
Objective function (negative log-likelihood): 899.9
print(pct, FUN = function(x) " *")
Partial credit tree

Model formula:
s2 ~ anger + gender

Fitted party:
[1] root
|   [2] gender in female *
|   [3] gender in male *

Number of inner nodes:    1
Number of terminal nodes: 2
Number of parameters per node: 11
Objective function (negative log-likelihood): 899.9
## show summary for terminal panel nodes
summary(pct)
$`2`

Partial credit model

Item category parameters:
                 Estimate Std. Error z value Pr(>|z|)    
s2S2WantCurse-C2    1.486      0.303    4.90  9.6e-07 ***
s2S2DoCurse-C1      1.169      0.265    4.42  9.9e-06 ***
s2S2DoCurse-C2      3.239      0.478    6.78  1.2e-11 ***
s2S2WantScold-C1    1.097      0.266    4.12  3.8e-05 ***
s2S2WantScold-C2    2.903      0.473    6.13  8.5e-10 ***
s2S2DoScold-C1      2.006      0.270    7.44  1.0e-13 ***
s2S2DoScold-C2      4.791      0.508    9.44  < 2e-16 ***
s2S2WantShout-C1    1.618      0.268    6.04  1.5e-09 ***
s2S2WantShout-C2    3.768      0.486    7.75  9.0e-15 ***
s2S2DoShout-C1      3.198      0.296   10.80  < 2e-16 ***
s2S2DoShout-C2      6.705      0.575   11.66  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Log-likelihood: -689 (df = 11) 
Number of iterations in BFGS optimization: 17 


$`3`

Partial credit model

Item category parameters:
                 Estimate Std. Error z value Pr(>|z|)    
s2S2WantCurse-C2    0.555      0.548    1.01  0.31136    
s2S2DoCurse-C1     -0.218      0.507   -0.43  0.66709    
s2S2DoCurse-C2     -0.124      0.780   -0.16  0.87361    
s2S2WantScold-C1    0.807      0.464    1.74  0.08195 .  
s2S2WantScold-C2    1.702      0.789    2.16  0.03105 *  
s2S2DoScold-C1      0.292      0.453    0.64  0.51902    
s2S2DoScold-C2      1.772      0.800    2.21  0.02681 *  
s2S2WantShout-C1    1.570      0.465    3.37  0.00074 ***
s2S2WantShout-C2    3.667      0.878    4.18  3.0e-05 ***
s2S2DoShout-C1      2.101      0.485    4.33  1.5e-05 ***
s2S2DoShout-C2      5.439      1.038    5.24  1.6e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Log-likelihood: -211 (df = 11) 
Number of iterations in BFGS optimization: 18 
## visualization
plot(pct, type = "regions")

plot(pct, type = "profile")

## extract item and threshold parameters
coef(pct)
  s2S2WantCurse-C2 s2S2DoCurse-C1 s2S2DoCurse-C2 s2S2WantScold-C1
2           1.4864         1.1691          3.239           1.0970
3           0.5547        -0.2179         -0.124           0.8065
  s2S2WantScold-C2 s2S2DoScold-C1 s2S2DoScold-C2 s2S2WantShout-C1
2            2.903         2.0057          4.791            1.618
3            1.702         0.2919          1.772            1.570
  s2S2WantShout-C2 s2S2DoShout-C1 s2S2DoShout-C2
2            3.768          3.198          6.705
3            3.667          2.101          5.439
itempar(pct)
  s2S2WantCurse s2S2DoCurse s2S2WantScold s2S2DoScold s2S2WantShout s2S2DoShout
2       -1.1646      -0.288       -0.4561      0.4877      -0.02374       1.445
3       -0.8069      -1.146       -0.2332     -0.1983       0.74950       1.635
  s2S2WantCurse-C1 s2S2WantCurse-C2 s2S2DoCurse-C1 s2S2DoCurse-C2
2           -1.908          -0.4213        -0.7386         0.1626
3           -1.084          -0.5296        -1.3022        -0.9903
  s2S2WantScold-C1 s2S2WantScold-C2 s2S2DoScold-C1 s2S2DoScold-C2
2          -0.8108          -0.1013        0.09792         0.8775
3          -0.2777          -0.1887       -0.79234         0.3958
  s2S2WantShout-C1 s2S2WantShout-C2 s2S2DoShout-C1 s2S2DoShout-C2
2          -0.2893           0.2418          1.290          1.599
3           0.4855           1.0135          1.016          2.254
## inspect parameter stability tests in the splitting node
if(require("strucchange")) sctest(pct, node = 1)
            anger    gender
statistic 16.2334 4.354e+01
p.value    0.9578 1.746e-05
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))