library(learnr)
library(learnSEM)
knitr::opts_chunk$set(echo = FALSE)
library(mirt)
library(ltm)
data(dirtdata)
data(mirtdata)
mirtdata$q5 <- 8 - mirtdata$q5
mirtdata$q8 <- 8 - mirtdata$q8
mirtdata$q13 <- 8 - mirtdata$q13

Item Response Theory

Item Response Theory is a latent trait analysis with a different focus traditionally used in understanding how a test performs. We will examine both dichotomous (yes/no) and polytomous (multiple options) scales to determine each item's characteristics. The learning outcomes are:

IRT Videos

You can use vignette("lecture_irt", "learnSEM") to view these notes in R.

Exercises

In this next section, you will answer questions using the R code blocks provided. Be sure to use the solution option to see the answer if you need it!

Please enter your name for submission. If you do not need to submit, just type anything you'd like in this box.

question_text(
  "Student Name:",
  answer("Your Name", correct = TRUE),
  incorrect = "Thanks!",
  try_again_button = "Modify your answer",
  allow_retry = TRUE
)

Dichotomous IRT

The included dataset includes data from an Educational Psychology Test scored as 0 (answered incorrectly) and 1 (answered correctly). The data has been imported for you.

data(dirtdata)
head(dirtdata)

Two Parameter Logistic

Include a 2PL calculated on just columns V2 through V5. Save the model as edu.model. Use the coef() function to examine the difficulty and discrimination parameters.


edu.model <- ltm(dirtdata ~ z1, IRT.param = TRUE)
coef(edu.model)

2PL Plots

Include the ICC and TIF plots to view all the items and overall test information at once.

edu.model <- ltm(dirtdata ~ z1, IRT.param = TRUE)

plot(edu.model, type = "IIC")
plot(edu.model, type = "IIC", items = 0)

Three Parameter Logistic

Include the 3PL model as edu2.model. Use the coef() function to examine the difficulty, discrimination, and guessing parameters. Name this model edu.model2.


edu.model2 <- tpm(dirtdata, type="latent.trait", IRT.param = TRUE)
coef(edu.model2)

3PL Plots

Include the ICC and TIF plots to view all the items and overall test information at once.

edu.model2 <- tpm(dirtdata, type="latent.trait", IRT.param = TRUE)

plot(edu.model2, type="ICC")
plot(edu.model2, type = "IIC", items = 0)

Compare Models

Use the anova() function to compare the two models.

edu.model <- ltm(dirtdata ~ z1, IRT.param = TRUE)
edu.model2 <- tpm(dirtdata, type="latent.trait", IRT.param = TRUE)

anova(edu.model, edu.model2)
question_text(
  "Which model was better? Does it appear that the guessing parameter adds something useful to the model? ",
  answer("Nope! The 2PL is a better representation.", correct = TRUE),
  incorrect = "Nope! The 2PL is a better representation.",
  try_again_button = "Modify your answer",
  allow_retry = TRUE
)
question_text(
  "Which items would be considered good items based on discrimination?",
  answer("Nearly all are good discriminators, but pretty easy.", correct = TRUE),
  incorrect = "Nearly all are good discriminators, but pretty easy.",
  try_again_button = "Modify your answer",
  allow_retry = TRUE
)

Polytomous IRT

Load the assignment_mirt data below. You should reverse code items 5, 8, and 13 using 8 - columns to ensure all items are in the same direction. The scale included examines evaluations of job candidates rated on 15 different qualities.

data(mirtdata)
head(mirtdata)

Graded Partial Credit Model

Create a graded partial credit model to analyze the scale, and save this model as gpcm.model. Include the coef() for the model to help you answer the questions below.


gpcm.model <- mirt(data = mirtdata, 
                  model = 1, 
                  itemtype = "gpcm")

coef(gpcm.model, IRTpars = T)

GPCM Plots

Include the ICC and TIF plots to view all the items and overall test information at once.

gpcm.model <- mirt(data = mirtdata, 
                  model = 1, 
                  itemtype = "gpcm")

plot(gpcm.model, type = "trace") 
plot(gpcm.model, type = "info")
question_text(
  "Examine the items. Do they appear ordered where each answer function is ordered correctly from 1 to 7?",
  answer("Yes, they mostly appear ordered.", correct = TRUE),
  incorrect = "Yes, they mostly appear ordered.",
  try_again_button = "Modify your answer",
  allow_retry = TRUE
)
question_text(
  "Examine the items. Do we need all 7 items on this scale? (i.e., do they all have the probability of being the most likely answer choice?)",
  answer("Unlikely, maybe only four points.", correct = TRUE),
  incorrect = "Unlikely, maybe only four points.",
  try_again_button = "Modify your answer",
  allow_retry = TRUE
)
question_text(
  "Which items indicate good discrimination?",
  answer("Pretty much all of them but 8 and 13.", correct = TRUE),
  incorrect = "Pretty much all of them but 8 and 13.",
  try_again_button = "Modify your answer",
  allow_retry = TRUE
)

Submit

On this page, you will create the submission for your instructor (if necessary). Please copy this report and submit using a Word document or paste into the text window of your submission page. Click "Generate Submission" to get your work!

encoder_logic()
encoder_ui()


doomlab/learnSEM documentation built on Jan. 25, 2024, 2 p.m.