(This article was first published on

I wanted to thank those of you who have emailed and commented on my last post and its Link to Item Response Theory Presentations Using R. In the Psychometrics Centre website, it is not until Topic 7 called **Engaging Market Research**, and kindly contributed to R-bloggers)**Unidimensional IRT models for binary data**that we get to the R code for the ltm package. You need to download the data file called Poly_GHQ28_Course.txt before you can run the R code in the presentation.

Unfortunately, the data file contains the data for a polytomous IRT, and it needs one recode before you can use it. You do not need to do much, just recode the 2's as 1's. This code seems to work, and the presentation explains how to interpret the findings.

`GHQ28 <- read.table(file.choose(),`

header=TRUE, sep="\t",

na.strings="NA", dec=".",

strip.white=TRUE)

Anxiety<-GHQ28[ ,8:14]

library(ltm)

Anxiety2<-Anxiety

`apply(Anxiety2, 2, table)`

#recodes 2's to 1's

`Anxiety2[Anxiety2==2]<-1`

apply(Anxiety2, 2, table)

Result1PL<-rasch(Anxiety2)

summary(Result1PL)

plot(Result1PL)

Result2PL<-ltm(Anxiety2 ~ z1)

summary(Result2PL)

plot(Result2PL)

anova(Result1PL,Result2PL)

`#May require more than one run to converge`

`Result3PL<-tpm(Anxiety2,control=c(iter.qN=10000,`

GHk=50,verbose=TRUE),start.val="random")

summary(Result3PL)

`plot(Result3PL)`

anova(Result2PL,Result3PL)

If you are just starting to learn about item response theory, it might help if you watched an introductory video. There is no R code, but Nick Shryane is slow and deliberate. This video should fill in the gaps for many of you. It's called "What is Item Response Theory?" After 46 minutes, you ought to have a pretty good idea.

As always, I learn a great deal from your comments and emails. Thanks for your help.

To

**leave a comment**for the author, please follow the link and comment on his blog:**Engaging Market Research**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...