# WrightMap and TAM – Example continued…

**R Snippets for IRT**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

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).

Let’s start with the same setup:

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.

**leave a comment**for the author, please follow the link and comment on their blog:

**R Snippets for IRT**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

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