uIRT {lazy.irt}R Documentation

Item Parameter Estimation of Unidimensional IRT

Description

Marginal likelihood will be maximized by the EM algorithm using ordinal_reg funcion and smn function in the M-step.

Usage

uIRT(Uc, U = NULL, items = NULL, groupvar = NULL, idvar = NULL,
  ncat = NULL, type = NULL, itemname = NULL, DinP = 1, param = NULL,
  msn = NULL, fixeditems = NULL, baseform = 1, theta = NULL,
  thd = NULL, estmu = 0, estsigma = 0, npoints = 21, thmin = -4,
  thmax = 4, maxiter = 200, eps = 1e-07, epsd = 1e-06, maxiter2 = 20,
  eps2 = 1e-04, nstrict = 9, maxiter22 = 5, minp1 = 0.1,
  maxabsparam = 20, SQUAREM = 3, nSQUAREM = 1, minalpha = -999,
  maxalpha = -1, always = 1, reset1 = 0, reset2 = 1, print = 2,
  plot = 0, smallP = 0, debug = 0)

Arguments

Uc

n x nitems+1 or +2 compressed item resopnse data frame in BILOG-MG's expanded format. (idvar and groupvar)

U

n x sum(ncat)+1 or +2 uncompressed irem response data frame

items

a vector consisting of the column names of U or Uc to be used as the item responses.
Or NULL to use all columns except for groupvar and idvar.
(Not Yet Available)

groupvar

name of the grouping varible contained as a column of Uc or NULL.

idvar

name of the id varible contained as a column of Uc or NULL

ncat

nitems x 1 # of categories for each item or NULL.

type

nitems x 1 vector of item types consisting of: "Bn" | "G" | "PN" | "P"
If NULL, P will be used.

itemname

nitems x 1 vector of item names or NULL.

DinP

= 0 to exclude 1.7 from logistic function.

param

nitems x max(ncat) initial value data frame for item param
Only the subset of the items can be given.
param$name and the colname(Uc) will be used to match the items.

msn

nG x 3 initial value matrix of (mean, std, n) for each group

fixeditems

list of items whose item parameters are to be fixed
to the values given in the param data frame.
Item numbers or item names

baseform

base form number whose theta distribution is fixed at the values given in msn[baseform,]
If there are fixed items, the values of the item paramters given in the param data frame must be on the baseform scale.

theta

npoints x 1 discrete theta points

thd

NOT used.

estmu

= 1 to estimate multigroup theta means

estsigma

= 1 to estimate mul tigroup theta std

npoints

# of discrete theta points between (thmin, thmax)

thmin

Minimum value of theta points to be generated.

thmax

Maximum value of theta points to be generated

maxiter

max # of iterations

eps

eps for the relative improvement of lmlh

epsd

eps for the max. abs. diff. of msn
Seems this is important.

maxiter2

max # of iterations for ordinal_reg and smn when llll <= nstrict.

eps2

eps for the relative improvement of llh in ordinal_reg and smn.

nstrict

maxiter2 will be reduced to maxiter22 after nstrict iterations.

maxiter22

max # of iterations for ordinal_reg and smn when llll > nstrict.

minp1

Minimum value of p1 parameter for type != "N" items.

maxabsparam

Maximum absolute value of parameters.

SQUAREM

= 3 : See the help of iSQUAREM in lazy.accel package.

nSQUAREM

when to star iSQUAREM

minalpha

= -999 : See the help of iSQUAREM in lazy.accel package.

maxalpha

= -1 : See the help of iSQUAREM in lazy.accel package.

always

= 0 : See the help of iSQUAREM in lazy.accel package.

reset1

= 1 : See the help of iSQUAREM in lazy.accel package.

reset2

= 2 : See the help of iSQUAREM in lazy.accel package.

print

= 1 to print the result

plot

= 1 to plot the estimated theta distributions

smallP

= Minimum value of P

debug

= 1 to print intermediate result

Details

Uc is the compressed data if it is n x nitems.
U is the uncompressed data if it is n x sum(ncat).

When U, instead of Uc, is given:
Item names come from itemname or paste("Q",1:nitems,sep="") is used.
ncat must be given.

When Uc is given:
Item names come from colnames(Uc) or itemname.
ncat can be calculated from Uc.


Note on the iSQUAREM:
Try always=1 with maxalpha=-1 or less first.
Changing to reset1=1 and reset2=2 or increasing nSQUAREM may help.
If it seems not working, use always=0 with maxalpha=1 or less.
Changing to reset1=1 and reset2=2 may help.
If all of the above fail, be patient and use SQUAREM=0.

Value

A list of: param Estimated Item Parameters in a data frame
msn Estimated means, standard deviations, and n for each group.
theta Discrete theta points used.
thd Theta distribution
converged = 1 if converged, = 0 otherwise.
lmlh Log Marginal LIkelihood maximized
iter_hist A list of iteration history
H Posterior distribution of theta given U.
NN Estimated # of persons at each of theta points
EAP Estimated ability
pstdtd Estimated posterior std for theta
id Id variable

References

Varadhan, R. and Roland, C.(2007) Simple and Globally Convergent Methods for Accelerating the Convergence of Any EM Algorithm. Scandinavian Journal of Statistics, Vol. 35: 335-353.

Examples

#
#### In the following examples, maxiter is set to 20 which is
#### not large enough to obtain convergence.
####
#
#
# Binary Items: simgle group analysis from compressed data: Uc
# generate 3PLM data
set.seed(1701)
Uc <- gendataIRT( 1, paramB2, npoints=500, thdist="rnorm", compress=1 )$U
Uc <- as.data.frame(Uc)

# 2PLM analysis
itemtype <- rep("B2",nrow(paramB2))
res1 <- uIRT( Uc, type=itemtype, maxiter=200 )

# 3PLM analysis
itemtype <- rep("B3",nrow(paramB2))
res1 <- uIRT( Uc, type=itemtype, maxiter=200 )


# Mixed Type Items: simgle group analysis from compressed data: Uc

# generate data
set.seed(1701)
Uc <- gendataIRT( 1, paramS1, npoints=500, thdist="rnorm"
                    , compress=1 )$U
Uc <- as.data.frame(Uc)
itemtype <- paramS1$type
res1 <- uIRT( Uc, type=itemtype, maxiter=20 )

# convert compressed data to uncompressed data: U
temp=dummy_expand( Uc )
U=data.frame( temp$U )
ncat=temp$ncat
rm(temp)
res2 <- uIRT( U=U, ncat=ncat, type=itemtype, maxiter=20 )

# should be identical
Print(res1$param, res2$param)


# fixed parameter values
paramF <- paramS1[2:3,]; fixeditems=c("Q2","Q3")
res1 <- uIRT( Uc, type=itemtype, maxiter=20, param=paramF
         , fixeditems=fixeditems )


# multi-group analysis with different theta distributions
set.seed(1701)
indata1 <- gendataIRT( 1, paramS1, npoints=500, thdist="rnorm"
                     , compress=1 )$U
indata1 <- as.data.frame(indata1,row.names=NULL)
indata1 <- data.frame(group="G1",indata1, stringsAsFactors=0
,row.names=NULL)
indata2 <- gendataIRT( 1, paramS1, npoints=500, thdist="rnorm", compress=1
                     , thmean=1, thstd=1 )$U
indata2 <- as.data.frame(indata2,row.names=NULL)
indata2 <- data.frame(group="G2",indata2, stringsAsFactors=0
,row.names=NULL)
indata12 <- rbind(indata1,indata2)
itemtype <- paramS1$type
# This will not converge: increase maxiter.
res1 <- uIRT( indata12, groupvar="group", type=itemtype, maxiter=10
, baseform=1, estmu=1, estsigma=1, minalpha=-2, SQUAREM=3, plot=1 )


# example of U matrix input with unequal # of trials per item.
set.seed(1701)
npoints=2000
param=paramS2
nitems=nrow(param)
ncat=param$ncat
Nmat=matrix(sample(1:9,npoints*nitems,replace=1),npoints,nitems)
pmiss=0.2
for( j in 1:nitems ){
  Nmat[sample(1:npoints,npoints*pmiss),j]=0
}
temp <- gendataIRT( 1, param, Nmat=Nmat, npoints=npoints
                    , thdist="rnorm", compress=0 )
ncat=temp$ncat
UN <- as.data.frame(temp$U)
res3 <- uIRT( U=UN, ncat=ncat, maxiter=20 )



[Package lazy.irt version 0.1.3 Index]