Skip to main content

Predict Methods for Item Response Models

Description

Prediction of (cumulated) response probabilities and responses based on fitted item response models.

Usage

## S3 method for class 'pcmodel'
predict(object, newdata = NULL, type = c("probability",
  "cumprobability", "mode", "median", "mean", "category-information",
  "item-information", "test-information"), ref = NULL, ...)

Arguments

object a fitted model object whose item parameters should be used for prediction.
newdata an optional (possibly named) vector of person parameters used for prediction. If NULL (the default), the person parameters of the subjects used to fit the model in object are used.
type character of length one which determines the type of prediction (see details below).
ref arguments passed over to internal calls of itempar or threshpar. Not used for models estimated via MML.
… further arguments which are currently not used.

Details

Depending on the value of type either probabilities, responses or some form of information under the model specified in object are returned:

If type is “probability”, the category response probabilities are returned.

If type is “cumprobability”, the cumulated category response probabilities are returned, i.e., \(P(X_{ij} \geq k)\) with \(k\) corresponding to the categories of item \(j\).

If type is “mode”, the most probable category response for a given subject and item is returned.

If type is “median”, the first category \(k\) where \(P(X_{ij} = k) \geq 0.5\) is returned.

If type is “mean”, the rounded expected category response, i.e., \(E(X_{ij}|\theta_{i})\), is returned.

If type is “category-information”, the item-category information as suggested by Bock (1972) is returned.

If type is “item-information”, the item information as suggested by Samejima (1974) is returned.

If type is “test-information”, the sum over the individual item information values is returned.

Value

A (possibly named) numeric matrix with rows corresponding to subjects and columns corresponding to the whole test, the single items or categories. The exact content depends on the value of type (see details above).

References

Bock RD (1972). Estimating Item Parameters and Latent Ability When Responses Are Scored in Two or More Nominal Categories. Psychometrika, 37(1), 29–51.

Samejima F (1974). Normal Ogive Model on the Continuous Response Level in the Multidimensional Latent Space. Psychometrika, 39(1), 111–121.

See Also

The help page of the generic function predict and other predict methods (e.g., predict.lm, predict.glm, …)

Examples

library("psychotools")

o <- options(digits = 4)

## load verbal aggression data
data("VerbalAggression", package = "psychotools")

## fit a partial credit model to first ten items
pcmod <- pcmodel(VerbalAggression$resp[, 1:10])

## predicted response probabilities for each subject and category (the default)
head(predict(pcmod), 3)
     S1WantCurse-C0 S1WantCurse-C1 S1WantCurse-C2 S1DoCurse-C0 S1DoCurse-C1
[1,]         0.6513         0.2742        0.07457       0.6387       0.2991
[2,]         0.3956         0.3749        0.22950       0.3927       0.4139
[3,]         0.1367         0.3345        0.52886       0.1427       0.3885
     S1DoCurse-C2 S1WantScold-C0 S1WantScold-C1 S1WantScold-C2 S1DoScold-C0
[1,]      0.06211         0.7757         0.1853        0.03895       0.7895
[2,]      0.19342         0.5580         0.3001        0.14194       0.5917
[3,]      0.46885         0.2448         0.3399        0.41531       0.2904
     S1DoScold-C1 S1DoScold-C2 S1WantShout-C0 S1WantShout-C1 S1WantShout-C2
[1,]       0.1853      0.02522         0.8247         0.1607        0.01453
[2,]       0.3125      0.09576         0.6545         0.2871        0.05843
[3,]       0.3961      0.31349         0.3665         0.4153        0.21827
     S1DoShout-C0 S1DoShout-C1 S1DoShout-C2 S2WantCurse-C0 S2WantCurse-C1
[1,]       0.9191      0.07589      0.00500        0.51720         0.3838
[2,]       0.8241      0.15315      0.02271        0.27473         0.4589
[3,]       0.6010      0.28848      0.11050        0.08487         0.3662
     S2WantCurse-C2 S2DoCurse-C0 S2DoCurse-C1 S2DoCurse-C2 S2WantScold-C0
[1,]        0.09899       0.7157       0.2356      0.04868         0.7471
[2,]        0.26638       0.4795       0.3553      0.16521         0.5208
[3,]        0.54898       0.1918       0.3672      0.44097         0.2201
     S2WantScold-C1 S2WantScold-C2 S2DoScold-C0 S2DoScold-C1 S2DoScold-C2
[1,]         0.2108        0.04206       0.8444       0.1423      0.01335
[2,]         0.3307        0.14852       0.6852       0.2599      0.05490
[3,]         0.3611        0.41879       0.3978       0.3897      0.21259
## predicted mode (most probable category) for certain subjects whose person
## parameters are given via argument "newdata"
predict(pcmod, type = "mode",
  newdata = c("Sarah" = 1.2, "Michael" = 0.1, "Arnd" = -0.8))
        S1WantCurse S1DoCurse S1WantScold S1DoScold S1WantShout S1DoShout
Sarah             2         2           2         2           2         2
Michael           2         2           2         1           1         0
Arnd              0         1           0         0           0         0
        S2WantCurse S2DoCurse S2WantScold S2DoScold
Sarah             2         2           2         2
Michael           2         2           2         0
Arnd              1         0           0         0
## rounded expected category value for the same subjects
predict(pcmod, type = "mean",
  newdata = c("Sarah" = 1.2, "Michael" = 0.1, "Arnd" = -0.8))
        S1WantCurse S1DoCurse S1WantScold S1DoScold S1WantShout S1DoShout
Sarah             2         2           2         2           1         1
Michael           1         1           1         1           1         0
Arnd              1         1           1         0           0         0
        S2WantCurse S2DoCurse S2WantScold S2DoScold
Sarah             2         2           2         1
Michael           1         1           1         1
Arnd              1         1           1         0
## in the Rasch model mode, mean and median are the same
raschmod <- raschmodel(VerbalAggression$resp2[, 1:10])
med <- predict(raschmod, type = "median")
mn <- predict(raschmod, type = "mean")
mod <- predict(raschmod, type = "mode")

head(med, 3)
     S1WantCurse S1DoCurse S1WantScold S1DoScold S1WantShout S1DoShout
[1,]           0         0           0         0           0         0
[2,]           1         1           1         1           0         0
[3,]           1         1           1         1           0         0
     S2WantCurse S2DoCurse S2WantScold S2DoScold
[1,]           1         0           0         0
[2,]           1         1           1         0
[3,]           1         1           1         0
all.equal(med, mn)
[1] TRUE
all.equal(mod, mn)
[1] TRUE
options(digits = o$digits)