mirt packageFirst, we will load the required package and data set. The LSAT is obtained from package ltm
setwd("D:/Class Materials & Work/Summer 2020 practice/IRT_Dicho")
library(mirt)
LSAT <- data.frame(ltm::LSAT)
With mirt function, we will use model=1 to indicate that we expect only one factor to be extracted in this exploratory analysis. itemtype="Rasch" is used to specify that we will be using Rasch model.
ltm::descript(LSAT)
##
## Descriptive statistics for the 'LSAT' data-set
##
## Sample:
## 5 items and 1000 sample units; 0 missing values
##
## Proportions for each level of response:
## 0 1 logit
## Item.1 0.076 0.924 2.4980
## Item.2 0.291 0.709 0.8905
## Item.3 0.447 0.553 0.2128
## Item.4 0.237 0.763 1.1692
## Item.5 0.130 0.870 1.9010
##
##
## Frequencies of total scores:
## 0 1 2 3 4 5
## Freq 3 20 85 237 357 298
##
##
## Point Biserial correlation with Total Score:
## Included Excluded
## Item.1 0.3620 0.1128
## Item.2 0.5668 0.1532
## Item.3 0.6184 0.1728
## Item.4 0.5344 0.1444
## Item.5 0.4354 0.1216
##
##
## Cronbach's alpha:
## value
## All Items 0.2950
## Excluding Item.1 0.2754
## Excluding Item.2 0.2376
## Excluding Item.3 0.2168
## Excluding Item.4 0.2459
## Excluding Item.5 0.2663
##
##
## Pairwise Associations:
## Item i Item j p.value
## 1 1 5 0.565
## 2 1 4 0.208
## 3 3 5 0.113
## 4 2 4 0.059
## 5 1 2 0.028
## 6 2 5 0.009
## 7 1 3 0.003
## 8 4 5 0.002
## 9 3 4 7e-04
## 10 2 3 4e-04
results.rasch <- mirt(data=LSAT, model=1, itemtype="Rasch", SE=TRUE, verbose=FALSE)
coef.rasch <- coef(results.rasch, IRTpars=TRUE, simplify=TRUE)
items.rasch <- as.data.frame(coef.rasch$items)
print(items.rasch)
## a b g u
## Item.1 1 -2.7306377 0 1
## Item.2 1 -0.9988875 0 1
## Item.3 1 -0.2399273 0 1
## Item.4 1 -1.3068083 0 1
## Item.5 1 -2.0999312 0 1
From the result above, a-parameter (discrimination) of all items is constrained to 1, while b-parameter (difficulty) is freely estimated, and c-parameter (g column) or guessing parameter is set to zero.
Next, we would test the model fit with itemfit(). The fit_stats = "S_X2" method is called by default.
itemfit(results.rasch, fit_stats = "S_X2")
## item S_X2 df.S_X2 RMSEA.S_X2 p.S_X2
## 1 Item.1 0.436 2 0 0.804
## 2 Item.2 1.576 2 0 0.455
## 3 Item.3 0.872 1 0 0.351
## 4 Item.4 0.190 2 0 0.909
## 5 Item.5 0.190 2 0 0.909
The non-significant p-value in the result suggests an acceptable fit of the mode to the data.
Next, we will use method-plot to plot relevant information of the model.
plot(results.rasch, type = 'score', theta_lim = c(-4,4), lwd=2) #expected total score
plot(results.rasch, type = 'trace', theta_lim = c(-4,4), lwd=2) #Item Characteristic Curves
plot(results.rasch, type = 'infotrace', theta_lim = c(-4,4), lwd=2) #Item Information Function
plot(results.rasch, type = 'infoSE', theta_lim = c(-4,4), lwd=2) #Test Information Function + Standard Error