Let's imagine that we want to develop an IRT model that describes the probability that a basketball player scores a basket when he shoots the ball from a certain distance. Distance is a continuous variable, and let us assume that this is not an experiment but an observation in a natural setting. That is, individual players have different numbers of attempts and we cannot predetermine the distances from which they will shoot the ball.

The problem can be thought of as individual subjects repeatedly solving the same test item, but that item contains an offset (a fixed parameter). In the IRT paradigm, we can describe the problem as follows:

$$ P(\text{player } i \text{ scoring from distance } d) = \frac{1}{1+e^{-a(\theta_i-F(d))}} $$

Where $F(d)$ is an increasing function describing the change in task difficulty over distance. This function is assumed to be known, so it can be modeled as a fixed parameter that varies from trial to trial (i.e. offset).

I am trying to solve the problem with the help of an excellent mirt package. But I'm running into two obstacles.

1) How can I work with repeated measures using mirt? By default mirt works with data in the wide format:

Player First attempt Second attempt Third attempt
Michael 1 0 1
Larry 0 1 1

However, this method assumes a fixed number of distinct items. I would need to work with the long format, which allows for different numbers of repetitions of the same item:

Player Attempt score
Michael 1
Michael 0
Michael 1
Larry 0
Larry 1
Larry 1

2) Can an offset be introduced into the IRT model? The resulting table looks like this:

Player Attempt score F(d)
Michael 1 5.486
Michael 0 8.427
Michael 1 6.712
Larry 0 9.002
Larry 1 7.217
Larry 1 7.214
Larry 0 9.563

I've thought of several solutions, but none of them are elegant. I would be very grateful to any advanced user for a suggestion on how to solve the situation.

The problem I'm addressing is not really basketball related. I was just using the sport as an easy-to-understand metaphor.


1 Answer 1


There's a few strategies to pick from here, but keeping thinks reasonably kosher with the package setup, and capitalizing on the property missing data are MAR, you can specify a data structure that fills in not observed stimuli with NA placeholders for each participant.

Consider the following structure that transforms some distance measure to an intercept parameter d, and then builds the response patterns according to whether the person was administered a given fixed stimuli.

# d scaled input from 0-1 (0 = shortest distance, 1 = farthest)
Fd <- function(d){

# person 1 received first three stimuli levels, person 2 next three, person 3 some combination, etc
person1 <- c(1,1,0,NA,NA,NA)
person2 <- c(NA ,NA,NA,0,1,1)
person3 <- c(NA ,NA,0,0,NA,1)
dat <- rbind(person1, person2, person3)

Fds <- Fd(runif(6))
colnames(dat) <- sprintf('F(%.2f)', Fds)

        F(-0.41) F(1.45) F(1.29) F(-1.04) F(-2.37) F(-2.59)
person1        1       1       0       NA       NA       NA
person2       NA      NA       0        0        1       NA
person3       NA      NA       0        0       NA        1

From here is just a matter of specifying your d parameters, treating them as fixed during estimation, and potentially constraining them to be equal across persons if the same stimuli intensity is administered to different persons.

"Theta = 1-6
FIXED = (1-6, d)
CONSTRAIN = (1-6, d)   # in case there are shared Fd observations
START = (1, d, value1), (2, d2, value2), ..."

mod <- mirt(dat, model)

Only item discriminations will be estimated in this model, which will be problematic if you don't have repeated stimuli across persons. Hence, it would be better to treat this as a Rasch model where either the slopes are all fixed at 1 and VAR(theta) is estimated, or you constrain all the slope parameters to be equal during estimation and keeping the default VAR(theta)=1 identification constraint.

  • $\begingroup$ This was one of the directions I was considering. Thanks so much for the illustrative technical description of how to do this. $\endgroup$ Commented Oct 24, 2023 at 20:35
  • $\begingroup$ The second approach I thought of was to estimate the coefficients using lme4, since it is actually a logistic regression with a random person factor. But this would cost me the useful functionalities of the mirt package. $\endgroup$ Commented Oct 24, 2023 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.