Learn R Programming

sirt (version 1.5-0)

IRT.mle: Person Parameter Estimation

Description

Computes the maximum likelihood estimate (MLE), weighted likelihood estimate (WLE) and maximum aposterior estimate (MAP) of ability in unidimensional item response models (Penfield & Bergeron, 2005; Warm, 1989). Item response functions can be defined by the user.

Usage

IRT.mle(data, irffct, arg.list, theta=rep(0,nrow(data)), type = "MLE", 
     mu=0, sigma=1, maxiter = 20, maxincr = 3, h = 0.001, convP = 1e-04, 
     maxval = 9, progress = TRUE)

Arguments

data
Data frame with item responses
irffct
User defined item response (see Examples). Arguments must be specified in arg.list. The function must contain theta and ii (item index) as arguments.
theta
Initial ability estimate
arg.list
List of arguments for irffct.
type
Type of ability estimate. It can be "MLE" (the default), "WLE" or "MAP".
mu
Mean of normal prior distriubution (for type="MAP"
sigma
Standard deviation of normal prior distriubution (for type="MAP"
maxiter
Maximum number of iterations
maxincr
Maximum increment
h
Numerical differentiation parameter
convP
Convergence criterion
maxval
Maximum ability value to be estimated
progress
Logical indicating whether iteration progress should be displayed

Value

  • Data frame with estimated abilities (est) and its standard error (se).

References

Penfield, R. D., & Bergeron, J. M. (2005). Applying a weighted maximum likelihood latent trait estimator to the generalized partial credit model. Applied Psychological Measurement, 29, 218-233. Warm, T. A. (1989). Weighted likelihood estimation of ability in item response theory. Psychometrika, 54, 427-450.

See Also

See also the PP package for further person parameter estimation methods.

Examples

Run this code
#############################################################################
# EXAMPLE 1: Generalized partial credit model
#############################################################################

data(data.ratings1)
dat <- data.ratings1

# estimate model
mod1 <- rm.facets( dat[ , paste0( "k",1:5) ], rater=dat$rater, 
             pid=dat$idstud  , maxiter=15)
# extract dataset and item parameters
data <- mod1$procdata$dat2.NA
a <- mod1$ipars.dat2$a
b <- mod1$ipars.dat2$b
theta0 <- mod1$person$EAP
# define item response function for item ii
calc.pcm <- function( theta , a , b , ii ){
    K <- ncol(b)
    N <- length(theta)
    matrK <- matrix( 0:K , nrow=N , ncol=K+1 , byrow=TRUE)
    eta <- a[ii] * theta * matrK - matrix( c(0,b[ii,]), nrow=N, ncol=K+1, byrow=TRUE)
    eta <- exp(eta)
    probs <- eta / rowSums(eta, na.rm=TRUE)    
    return(probs)
            }
arg.list <- list("a"=a , "b"=b )

# MLE
abil1 <- IRT.mle( data, irffct=calc.pcm, theta=theta0, arg.list=arg.list )
str(abil1)
# WLE
abil2 <- IRT.mle( data, irffct=calc.pcm, theta=theta0, arg.list=arg.list, type="WLE")
str(abil2)
# MAP with prior distribution N(.2, 1.3)
abil3 <- IRT.mle( data, irffct=calc.pcm, theta=theta0, arg.list=arg.list, 
              type="MAP", mu=.2, sigma=1.3 )
str(abil3)

#############################################################################
# EXAMPLE 2: Rasch model
#############################################################################

data(data.read)
dat <- data.read
I <- ncol(dat)

# estimate Rasch model
mod1 <- rasch.mml2( dat )
summary(mod1)

# define item response function
irffct <- function( theta, b , ii){
    eta <- exp( theta - b[ii] )
    probs <- eta / ( 1 + eta )
    probs <- cbind( 1 - probs , probs )
    return(probs)
        }
# initial person parameters and item parameters
theta0 <- mod1$person$EAP
arg.list <- list( "b" = mod1$item$b  )

# estimate WLE
source.all(pfsirt)
abil <- IRT.mle( data = dat , irffct=irffct , arg.list=arg.list , 
            theta=theta0, type="WLE")
# compare with wle.rasch function
theta <- wle.rasch( dat , b= mod1$item$b )
cbind( abil[,1] , theta$theta , abil[,2] , theta$se.theta )

#############################################################################
# EXAMPLE 3: Ramsay quotient model
#############################################################################

data(data.read)
dat <- data.read
I <- ncol(dat)

# estimate Ramsay model
mod1 <- rasch.mml2( dat , irtmodel ="ramsay.qm" )
summary(mod1)
# define item response function
irffct <- function( theta, b , K , ii){
    eta <- exp( theta / b[ii] )
    probs <- eta / ( K[ii] + eta )
    probs <- cbind( 1 - probs , probs )
    return(probs)
        }
# initial person parameters and item parameters
theta0 <- exp( mod1$person$EAP )
arg.list <- list( "b" = mod1$item2$b , "K"=mod1$item2$K )
# estimate MLE
res <- IRT.mle( data = dat , irffct=irffct , arg.list=arg.list , theta=theta0 ,
            maxval=20 , maxiter=50)

Run the code above in your browser using DataLab