Clarifying a Previous Item Response Theory Link

December 11, 2012

(This article was first published on Engaging Market Research, and kindly contributed to R-bloggers)

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 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=".",
Anxiety<-GHQ28[ ,8:14]

apply(Anxiety2, 2, table)
#recodes 2's to 1's

apply(Anxiety2, 2, table)


Result2PL<-ltm(Anxiety2 ~ z1)

#May require more than one run to converge


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 their blog: Engaging Market Research. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)