- Notifications
You must be signed in to change notification settings - Fork4
okanbulut/eirm
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Theeirm package, which is essentially a wrapper around thelme4 andblme packages, provides a simple and easy-to-use set of tools forpreparing data, estimatingexplanatory item response theory (IRT)models, extracting model output, and visualizing model results. Theprimary goal ofeirm is to streamline the processes of datapreparation, model estimation, and model interpretation for variousexplanatory IRT models. The functions in theeirm package enableresearchers to leverage the power oflme4 andblme for theestimation of explanatory IRT models while providing additional helperfunctions and visualization tools to better interpret the model output.
The latest version on CRAN can be installed by:
install.packages("eirm")The development version can be installed by:
devtools::install_github(repo="okanbulut/eirm")
Note: If you download the Github version and see the followingoutput on your console (or something similar), please choose3: Nonefrom this list. You can simply type3 in yourR console and hit“enter”.
DownloadingGitHubrepookanbulut/eirm@masterThesepackageshavemorerecentversionsavailable.Whichwouldyouliketoupdate?1:All2:CRANpackagesonly3:None4: Rcpp (1.0.1->1.0.3 ) [CRAN]5: RcppEigen (0.3.3.5.0->0.3.3.7.0) [CRAN]6: plyr (1.8.4->1.8.5 ) [CRAN]7: stringi (1.4.3->1.4.5 ) [CRAN]Enteroneormorenumbers,oranemptylinetoskipupdates:
If this also fails, you can run the following lines all together andselect3: None by typing3 in yourR console:
Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS=TRUE)devtools::install_github(repo="okanbulut/eirm")
To citeeirm in your work, please use the following APA-stylecitation:
Bulut, O. (2021).eirm: Explanatory item response modeling fordichotomous and polytomous item responses, R package version 0.4.doi: 10.5281/zenodo.4556285 Available fromhttps://CRAN.R-project.org/package=eirm.
Bulut, O., Gorgun, G., & Yildirim-Erbasli, S. N. (2021). Estimatingexplanatory extensions of dichotomous and polytomous Rasch models: Theeirm package in R.Psych, 3(3), 308-321. doi:10.3390/psych3030023
You can alsoprint(citation("eirm"), bibtex = TRUE) to view thecitations in BibTeX format.
You can useeirmShiny() to open the Shiny GUI for theeirm function:
I plan to expand the Shiny GUI with additional features in the future.Please let me know if you have any suggestions or comments.
Please visithttps://okanbulut.github.io/eirm for documentation andvignettes. For questions about the functionality, you may either contactme via email or also file an issue.
On the packagewebsite, you canaccess two vignettes demonstrating how to useeirm for:
- Estimating dichotomous explanatory IRTmodelswith binary data (e.g., 0 = Wrong, 1 = Right)
- Estimating polytomous explanatory IRTmodelswith ordinal data (e.g., 1 = No, 2 = Maybe, 3 = Yes)
To demonstrate how theeirm() function works with a quick example, wewill estimate the Rasch model (i.e., a fully descriptive model). Thefollowing example shows how to estimate item parameters for the verbalaggression data set (see?VerbAgg for further details). A preview oftheVerbAgg data set is shown below:
data("VerbAgg")head(VerbAgg)#> Anger Gender item resp id btype situ mode r2#> 1 20 M S1WantCurse no 1 curse other want N#> 2 11 M S1WantCurse no 2 curse other want N#> 3 17 F S1WantCurse perhaps 3 curse other want Y#> 4 21 F S1WantCurse perhaps 4 curse other want Y#> 5 17 F S1WantCurse perhaps 5 curse other want Y#> 6 21 F S1WantCurse yes 6 curse other want Y
To estimate the Rasch model, a regression-like formula must be defined:formula = "r2 ~ -1 + item + (1|id)". In the formula,
r2is the variable for dichotomous item responses-1removes the intercept from the model and yields parameterestimates for all items in the data set. With1(instead of-1),an intercept representing the parameter of the first item andrelative parameters for the remaining items (i.e., distance from theparameter of the first item) would be estimated.itemis the variable representing item IDs in the data set(1|id)refers to the random effects for persons represented by theidcolumn in the data set.
The output for the Rasch model is shown below:
mod1<- eirm(formula="r2 ~ -1 + item + (1|id)",data=VerbAgg)print(mod1)EIRMformula:"r2 ~ -1 + item + (1|id)"Numberofpersons:316Numberofobservations:7584Numberofpredictors:24ParameterEstimates:EasinessS.E.z-valuep-valueitemS1WantCurse1.221070.16117.57943.470e-14itemS1WantScold0.564770.15253.70322.129e-04itemS1WantShout0.080090.15050.53235.945e-01itemS2WantCurse1.748790.173810.06328.035e-24itemS2WantScold0.707720.15384.60204.184e-06itemS2WantShout0.011720.15040.07799.379e-01itemS3WantCurse0.529470.15223.47775.057e-04itemS3WantScold-0.686370.1542-4.45068.564e-06itemS3WantShout-1.526940.1692-9.02221.843e-19itemS4wantCurse1.082040.15876.81939.151e-12itemS4WantScold-0.349380.1515-2.30622.110e-02itemS4WantShout-1.044020.1591-6.56285.280e-11itemS1DoCurse1.221070.16117.57943.470e-14itemS1DoScold0.389620.15142.57391.006e-02itemS1DoShout-0.871220.1565-5.56802.576e-08itemS2DoCurse0.872640.15575.60632.067e-08itemS2DoScold-0.056680.1505-0.37667.065e-01itemS2DoShout-1.481860.1681-8.81521.195e-18itemS3DoCurse-0.211040.1509-1.39881.619e-01itemS3DoScold-1.504310.1687-8.91894.709e-19itemS3DoShout-2.975000.2334-12.74833.186e-37itemS4DoCurse0.707720.15384.60204.184e-06itemS4DoScold-0.384220.1517-2.53281.132e-02itemS4DoShout-1.999470.1839-10.87501.516e-27Note:Theestimatedparametersaboverepresent'easiness'.Usedifficulty=TRUEtogetdifficultyparameters.
By default, theeirm function returns theeasiness parametersbecause the function uses a regression model parameterization wherepositive parameters indicate positive association with the dependentvariable. In order to print the difficulty parameters (instead ofeasiness),print(mod1, difficulty = TRUE) must be used:
print(mod1,difficulty=TRUE)ParameterEstimates:DifficultyS.E.z-valuep-valueitemS1WantCurse-1.221070.16117.57943.470e-14itemS1WantScold-0.564770.15253.70322.129e-04itemS1WantShout-0.080090.15050.53235.945e-01itemS2WantCurse-1.748790.173810.06328.035e-24itemS2WantScold-0.707720.15384.60204.184e-06itemS2WantShout-0.011720.15040.07799.379e-01itemS3WantCurse-0.529470.15223.47775.057e-04itemS3WantScold0.686370.1542-4.45068.564e-06itemS3WantShout1.526940.1692-9.02221.843e-19itemS4wantCurse-1.082040.15876.81939.151e-12itemS4WantScold0.349380.1515-2.30622.110e-02itemS4WantShout1.044020.1591-6.56285.280e-11itemS1DoCurse-1.221070.16117.57943.470e-14itemS1DoScold-0.389620.15142.57391.006e-02itemS1DoShout0.871220.1565-5.56802.576e-08itemS2DoCurse-0.872640.15575.60632.067e-08itemS2DoScold0.056680.1505-0.37667.065e-01itemS2DoShout1.481860.1681-8.81521.195e-18itemS3DoCurse0.211040.1509-1.39881.619e-01itemS3DoScold1.504310.1687-8.91894.709e-19itemS3DoShout2.975000.2334-12.74833.186e-37itemS4DoCurse-0.707720.15384.60204.184e-06itemS4DoScold0.384220.1517-2.53281.132e-02itemS4DoShout1.999470.1839-10.87501.516e-27Note:Theestimatedparametersaboverepresent'difficulty'.
Themod1 object is essentially aglmerMod-class object from thelme4 package (Bates, Maechler, Bolker, & Walker(2015)). AllglmerModresults for the estimated model can seen withmod1$model. For example,estimated random effects for persons (i.e., theta estimates) can beobtained using:
theta<- ranef(mod1$model)$id
To visualize the results, we can create an item-person map usingplot(mod1), which returns the following plot. Note that this plot is amodified version of theplotPImap function from theeRm package(Mair, Hatzinger, Maier, Rusch, & Debelak,2020).
plot(mod1)Aesthetic elements such as axis labels and plot title can be added tothe plot. For example, the following code updates the x-axis label andthe main plot title (see?plot.eirm for further details).
plot(mod1,difficulty=TRUE,main="Verbal Aggression Example",latdim="Verbal Aggression")
which will show the difficulty parameters (instead of easiness), changethe main title above the plot, and change the x-axis – the name for thelatent trait being measured.
About
Explanatory Item Response Modeling for Dichotomous and Polytomous Item Responses
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.



