IRT.irfprobPlot {CDM}R Documentation

Plot Item Response Functions

Description

This function plots item response functions for fitted item response models for which the IRT.irfprob method is defined.

Usage

IRT.irfprobPlot( object, items=NULL, min.theta=-4, max.theta=4, cumul=FALSE,
     smooth=TRUE, ask=TRUE,  n.theta=40, package="lattice",... )

Arguments

object

Fitted item response model for which the IRT.irfprob method is defined

items

Vector of indices of selected items.

min.theta

Minimum theta to be displayed.

max.theta

Maximum theta to be displayed.

cumul

Optional logical indicating whether cumulated item response functions P( X ≥ k | θ ) should be displayed.

smooth

Optional logical indicating whether item response functions should be smoothed for plotting.

ask

Logical for asking for a new plot.

n.theta

Number of theta points if smooth=TRUE is chosen.

package

String indicating which package should be used for plotting the item response curves. Options are "lattice" or "graphics".

...

More arguments to be passed for the plot in lattice.

Examples

## Not run: 
#############################################################################
# EXAMPLE 1: Plot item response functions from a unidimensional model
#############################################################################

data(data.Students, package="CDM")

dat <- data.Students
resp <- dat[, paste0("sc",1:4) ]
resp[ paste(resp[,1])==3,1] <-  2
psych::describe(resp)

#--- Model 1: PCM in CDM::gdm
theta.k <- seq( -5, 5, len=21 )
mod1 <- CDM::gdm( dat=resp, irtmodel="1PL", theta.k=theta.k, skillspace="normal",
           centered.latent=TRUE)
summary(mod1)

# plot
IRT.irfprobPlot( mod1 )
# plot in graphics package (which comes with R base version)
IRT.irfprobPlot( mod1, package="graphics")
# plot first and third item and do not smooth discretized item response
# functions in IRT.irfprob
IRT.irfprobPlot( mod1, items=c(1,3), smooth=FALSE )
# cumulated IRF
IRT.irfprobPlot( mod1, cumul=TRUE )

#############################################################################
# EXAMPLE 2: Fitted mutidimensional model with gdm
#############################################################################

dat <- CDM::data.fraction2$data
Qmatrix <- CDM::data.fraction2$q.matrix3

# Model 1: 3-dimensional Rasch Model (normal distribution)
theta.k <- seq( -4, 4, len=11 )   # discretized ability
mod1 <- CDM::gdm( dat, irtmodel="1PL", theta.k=theta.k, Qmatrix=Qmatrix,
              centered.latent=TRUE, maxiter=10 )
summary(mod1)

# unsmoothed curves
IRT.irfprobPlot(mod1, smooth=FALSE)
# smoothed curves
IRT.irfprobPlot(mod1)

## End(Not run)

[Package CDM version 7.5-15 Index]