Last chance! 50% off unlimited learning
Sale ends in
pcmodel
is a basic fitting function for partial credit models.
pcmodel(y, weights = NULL, nullcats = c("keep", "downcode", "ignore"),
start = NULL, reltol = 1e-10, deriv = c("sum", "diff"),
hessian = TRUE, maxit = 100L, full = TRUE, ...)
pcmodel
returns an S3 object of class "pcmodel"
,
i.e., a list the following components:
a named vector of estimated item-category parameters (without the first item-category parameter which is constrained to 0),
covariance matrix of the parameters in the model,
modified data, used for model-fitting, i.e., cleaned for
items without variance, centralized so that the first category is
zero for all items, treated null categories as specified via
argument "nullcats"
and without observations with zero
weight. Be careful, this is different than for objects of class
"raschmodel"
or "btmodel"
, where data
contains
the original data,
logical vector of length ncol(dat)
, indicating
which items have variance (TRUE
), i.e., are identified and
have been used for the estimation or not (FALSE
),
list of length ncol(y)
, containing integer
vectors starting from one to the number of categories minus one per
item,
number of observations (with non-zero weights),
original number of observations in y
,
the weights used (if any),
logical indicating whether the data contain NAs,
either NULL
or, if there have been null
categories, a list of length ncol(y)
with logical vectors
specifying which categories are null categories (TRUE
) or not
(FALSE
),
list of elementary symmetric functions and their derivatives for estimated parameters,
log-likelihood of the fitted model,
number of estimated parameters,
convergence code from optim
,
number of iterations used by optim
,
tolerance passed to optim
,
original function call.
item response object that can be coerced (via as.matrix
)
to a numeric matrix with scores 0, 1, ... Typically, either
already a matrix, data frame, or dedicated object of class
itemresp
.
an optional vector of weights (interpreted as case weights).
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.
character string, specifying how items with null categories (i.e., categories not observed) should be treated (see details below).
an optional vector of starting values.
logical. Should the Hessian of the final model be computed?
If set to FALSE
, the vcov
method can only return NA
s
and consequently no standard errors or tests are available in the
summary
.
further arguments passed to optim
.
logical. Should a full model object be returned? If set to FALSE
,
no variance-covariance matrix and no matrix of estimating functions are computed.
pcmodel
provides a basic fitting function for partial
credit models, intended as a building block for fitting partial
credit trees. It estimates the partial credit model suggested
by Masters (1982) under the cumulative threshold parameterization,
i.e., the item-category parameters pcmodel
.
Null categories, i.e., categories which have not been used, can be
problematic when estimating a partial credit model. Several strategies
have been suggested to cope with null categories. pcmodel
allows to select from three possible strategies via the argument
nullcats
. If nullcats
is set to "keep"
(the
default), the strategy suggested by Wilson & Masters (1993) is used to
handle null categories. That basically means that the integrity of the
response framework is maintained, i.e., no category scores are
changed. This is not the case, when nullcats
is set to
"downcode"
. Then all categories above a null category are
shifted down to close the existing gap. In both cases ("keep"
and "downcode"
) the number of estimated parameters is reduced
by the number of null categories. When nullcats
is set to
"ignore"
, these are literally ignored and a threshold parameter
is estimated during the optimization nevertheless. This strategy is
used by the related package eRm when fitting partial credit
models via eRm::PCM
.
pcmodel
returns an object of class "pcmodel"
for
which several basic methods are available, including print
,
plot
, summary
, coef
, vcov
, logLik
,
discrpar
, itempar
, estfun
,
threshpar
, and personpar
.
Masters GN (1992). A Rasch Model for Partial Credit Scoring. Psychometrika, 47(2), 149--174.
Wilson M, Masters GN (1993). The Partial Credit Model and Null Categories. Psychometrika, 58(1), 87--99.
gpcmodel
, rsmodel
, raschmodel
,
nplmodel
, btmodel
o <- options(digits = 4)
## Verbal aggression data
data("VerbalAggression", package = "psychotools")
## Partial credit model for the other-to-blame situations
pcm <- pcmodel(VerbalAggression$resp[, 1:12])
summary(pcm)
## visualizations
plot(pcm, type = "profile")
plot(pcm, type = "regions")
plot(pcm, type = "piplot")
plot(pcm, type = "curves")
plot(pcm, type = "information")
## Get data of situation 1 ('A bus fails to
## stop for me') and induce a null category in item 2.
pcd <- VerbalAggression$resp[, 1:6, drop = FALSE]
pcd[pcd[, 2] == 1, 2] <- NA
## fit pcm to these data, comparing downcoding and keeping strategy
pcm_va_keep <- pcmodel(pcd, nullcats = "keep")
pcm_va_down <- pcmodel(pcd, nullcats = "downcode")
plot(x = coef(pcm_va_keep), y = coef(pcm_va_down),
xlab = "Threshold Parameters (Keeping)",
ylab = "Threshold Parameters (Downcoding)",
main = "Comparison of two null category strategies (I2 with null category)",
pch = rep(as.character(1:6), each = 2)[-3])
abline(b = 1, a = 0)
options(digits = o$digits)
Run the code above in your browser using DataLab