WrightMap features close integration with Conquest, allowing you to easily read from its output files. However, this is just a nice convenience for Conquest users, as WrightMap was designed to create beautiful item-person plots simply reading standard R matrices; all you need is a matrix of item parameters and a matrix of person estimates, and you can start creating nice Wright Maps. For this reason, the WrightMap package can be used to plot the results of any IRT software and makes it very easy to integrate with other R packages that estimate IRT models.
This post will show you how you can integrate R with one of these estimation packages, the Test Analysis Module (TAM) package, in just a couple of lines.
The estimation should take very little time, and you should see a summary of the results and the total time it took to run the analysis.
Person Estimates
You can get person estimates in several ways in TAM, but for this example, I will use the tam.wle command, which produces Warm Likelihood Estimates (WLE) for each respondent.
persons.mod1 <-tam.wle(mod1)
Iteration in WLE/MLE estimation 1 | Maximal change 0.8281
Iteration in WLE/MLE estimation 2 | Maximal change 0.4335
Iteration in WLE/MLE estimation 3 | Maximal change 0.0883
Iteration in WLE/MLE estimation 4 | Maximal change 7e-04
Iteration in WLE/MLE estimation 5 | Maximal change 0
----
WLE Reliability= 0.894
str(persons.mod1)
Classes 'tam.wle' and 'data.frame': 2000 obs. of 7 variables:
$ pid : int 1 2 3 4 5 6 7 8 9 10 ...
$ N.items : num 40 40 40 40 40 40 40 40 40 40 ...
$ PersonScores: num 19 14 35 14 27 12 23 17 5 12 ...
$ PersonMax : num 40 40 40 40 40 40 40 40 40 40 ...
$ theta : num -0.116 -0.791 2.373 -0.791 0.964 ...
$ error : num 0.366 0.377 0.498 0.377 0.382 ...
$ WLE.rel : num 0.894 0.894 0.894 0.894 0.894 ...
- attr(*, "ndim")= int 1
- attr(*, "nobs")= int 2000
- attr(*, "M_sq_error")= Named num 0.165
..- attr(*, "names")= chr "Dim1"
- attr(*, "WLEvar")= Named num 1.55
..- attr(*, "names")= chr "Dim1"
- attr(*, "WLEM")= Named num 0.000865
..- attr(*, "names")= chr "Dim1"
- attr(*, "WLE.rel")= num 0.894
- attr(*, "call")= language tam.wle(tamobj = mod1)
If we look at the resulting matrix, we can see that we have several columns, including:
pid: the ID of the respondent
N.items: the number of items
PersonScores: The score of each person
PersonMax: The maximum possible score of each person
theta: The WLE estimate
error: The standard error of the WLE estimate
WLE.rel: The WLE reliability
You can look at the TAM documentation for more details, but for this example, we want to focus on the theta column, which contains the person estimates we need to create our Wright map.
We can get the data we need by selecting just that column:
WLEestimates.mod1 <- persons.mod1$theta
Item Parameters
And we can get our item estimates using the tam.threshold command.
thresholds.mod1 <-tam.threshold(mod1)
Creating the Wright Map
With these two matrices, we are ready to plot our Wright Map: