# NOT RUN {
set.seed(17)
d9 <- sim.irt(9,1000,-2.5,2.5,mod="normal") #dichotomous items
test <- irt.fa(d9$items)
test
op <- par(mfrow=c(3,1))
plot(test,type="ICC")
plot(test,type="IIC")
plot(test,type="test")
par(op)
set.seed(17)
items <- sim.congeneric(N=500,short=FALSE,categorical=TRUE) #500 responses to 4 discrete items
d4 <- irt.fa(items$observed) #item response analysis of congeneric measures
d4 #show just the irt output
d4$fa #show just the factor analysis output
op <- par(mfrow=c(2,2))
plot(d4,type="ICC")
par(op)
#using the iq data set for an example of real items
#first need to convert the responses to tf
data(iqitems)
iq.keys <- c(4,4,4, 6, 6,3,4,4, 5,2,2,4, 3,2,6,7)
iq.tf <- score.multiple.choice(iq.keys,iqitems,score=FALSE) #just the responses
iq.irt <- irt.fa(iq.tf)
print(iq.irt,short=FALSE) #show the IRT as well as factor analysis output
p.iq <- plot(iq.irt) #save the invisible summary table
p.iq #show the summary table of information by ability level
#select a subset of these variables
small.iq.irt <- irt.select(iq.irt,c(1,5,9,10,11,13))
small.irt <- irt.fa(small.iq.irt)
plot(small.irt)
#find the information for three subset of iq items
keys <- make.keys(16,list(all=1:16,some=c(1,5,9,10,11,13),others=c(1:5)))
plot(iq.irt,keys=keys)
# }
# NOT RUN {
#compare output to the ltm package or Kamata and Bauer -- these are in logistic units
ls <- irt.fa(lsat6)
#library(ltm)
# lsat.ltm <- ltm(lsat6~z1)
# round(coefficients(lsat.ltm)/1.702,3) #convert to normal (approximation)
#
# Dffclt Dscrmn
#Q1 -1.974 0.485
#Q2 -0.805 0.425
#Q3 -0.164 0.523
#Q4 -1.096 0.405
#Q5 -1.835 0.386
#Normal results ("Standardized and Marginal")(from Akihito Kamata )
#Item discrim tau
# 1 0.4169 -1.5520
# 2 0.4333 -0.5999
# 3 0.5373 -0.1512
# 4 0.4044 -0.7723
# 5 0.3587 -1.1966
#compare to ls
#Normal results ("Standardized and conditional") (from Akihito Kamata )
#item discrim tau
# 1 0.3848 -1.4325
# 2 0.3976 -0.5505
# 3 0.4733 -0.1332
# 4 0.3749 -0.7159
# 5 0.3377 -1.1264
#compare to ls$fa and ls$tau
#Kamata and Bauer (2008) logistic estimates
#1 0.826 2.773
#2 0.723 0.990
#3 0.891 0.249
#4 0.688 1.285
#5 0.657 2.053
# }
Run the code above in your browser using DataLab