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
library("strucchange")
sctest(pct, node = 1)
options(digits = o$digits)
Run the code above in your browser using DataLab