#################################################################################### # L7 - IRT MODELS FOR ORDINAL AND NOMINAL ITEMS # # NMST570 # # Last update: 01/12/2020 # #################################################################################### # Slides available at http://www.cs.cas.cz/martinkova/NMST570.html # HW assignment available at http://www.cs.cas.cz/hladka/documents/NMST570_2020_HW7.pdf #################################################################################### # Loading data ##################################################################### #################################################################################### data <- read.csv("neuroticism500.csv", header = TRUE, row.names = 1) head(data) summary(data) #################################################################################### # Loading packages ################################################################# #################################################################################### library(mirt) #################################################################################### # Ex. 3.2. ######################################################################### #################################################################################### #----------------------------------------------------------------------------------- # 1. fit GRM model with mirt package with the same discrimination for all items ### open help for function mirt() ?mirt ### to fit GRM model with mirt() function. You need to specify data, model and itemtype ### first we need to specify constraints for parameter a: s <- 'F = 1-5 CONSTRAIN = (1-5, a1)' ### this mean that we assume one latent trait for all 5 items and we constrain ### parameter a to be the same for all items ### itemtype = "graded" means that we assumed GRM model for all items ### replace ??? fitGRM1 <- mirt(data = ???, model = s, itemtype = ???) summary(fitGRM1) ### print estimated parameters, replace ??? coef(???, simplify = TRUE) #----------------------------------------------------------------------------------- # 2. fit GRM model with mirt package with no constrain ### simply use model = 1 ### itemtype = "graded" means that we assumed GRM model for all items ### replace ??? fitGRM2 <- mirt(data = ???, model = ???, itemtype = ???) summary(fitGRM2) ### print estimated parameters, replace ??? coef(???, simplify = TRUE) #----------------------------------------------------------------------------------- # 3. decide between two models ### help for anova ??anova.SingleGroupClass ### now compare both models with anova() function ### replace ??? anova(???, ???) #----------------------------------------------------------------------------------- # 4. category response curve ### help for plot ??plot.SingleGroupClass ### plot category response curve ### you need to specify model and type. For category response curve use type = "trace" ### replace ??? plot(???, type = ???) #----------------------------------------------------------------------------------- # 5. item information curve ### item information curve ### you need to specify model and type. For item information curve use type = "infotrace" ### to plot all curves in one model use argument facet_items = F ### replace ??? plot(???, type = ???) #----------------------------------------------------------------------------------- # 6. test information curve ### test information curve ### you need to specify model and type. For test information curve use type = "infoSE" ### replace ??? plot(???, type = ???)