Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

As a follow up on the previous about integrating the TAM and WrightMap packages, we received a message from one of the TAM developers, Alexander Robitzsch, suggesting that it is possible to generate the Wright Map directly from the MML estimated distribution (instead of using the WLE estimates used in the previous post).

library(TAM)
library(WrightMap)
data( sim.rasch )
str( sim.rasch )
dat <- sim.rasch

# Run Rasch Model
mod1 <- tam.mml( dat )
summary( mod1 )


After estimating the Rasch model in our data, we can get the item parameters directly from our model object:

difficulties <- tam.threshold( mod1 )


Now, for the new part, Alexander has sent us this snippet to recover the estimated person distribution:

uni.proficiency <- rep( mod1$theta[,1] , round( mod1$pi.k * mod1$ic$n) )


This extracts the ability distribution node locations and weights, and uses them to generate a vector of abilities that can be used to plot that distribution on wrightMap:

wrightMap( thetas = uni.proficiency, thresholds = mod1\$xsi[,1], label.items.rows = 3)


This final Wright Map shows the distribution based on the nodes and weights estimated directly as part of the marginal maximum likelihood estimation, without needing to resort to generating person estimates on a separate step.