I’d like to write an R function on how to calculate item response probabilities for Item Response Theory (IRT) models. In this article I will consider only dichotomous items.

In the **previous post** I mentioned about three parameter model. In this post I will show a more general model: Four parameter model introduced by Barton and Lord (1981) to alleviate excessive punishment of high ability examinees when they make an error.

In this model, θ is the ability of an examinee, P(θ) is the probability of correctly responding i’th item for this examinee, *d* is the upper asymptote, *c* is pseudo-guessing parameter, *a* is item discrimination parameter, *b* is item difficulty parameter for *I*‘th examinee. D is scaling constant, it’s value is 1.7.

If *d* parameter is set 1, we get three parameter model:

If pseudo-guessing parameter *c* is set to 0, we get two parameter model:

If item discrimination value fixed for model and does not change from item to another item we get one parameter model:

Finally, if we set item discrimination parameter to 1, we get Rasch model:

Let’s write a basic R function to calculate probability of correct response to item with parameters (*a,b,c,d*) for an examinee with ability θ.

irt.3pl.basic <- function(t,a=1,b,c=0,d=1,D=1.7) { return( c + (d-c) / (1 + exp(-a * D * (t - b))) ) }

Let’s run this function with two examples. In the first example I’ll calculate the probability of correct response for an examinee with ability 0 to a question with item parameters a=1,b=0,c=0,d=1.

theta <- 0; a <- 1; b <- 0; c <- 0; d <- 1; irt.3pl.basic(t=theta,a=a,b=b,c=c,d=d) [1] 0.5

Since examinee’s ability and items difficulty corresponds there is a 50% chance that this examinee will correctly answer this question. In the next example let’s consider three examinees with theta’s -1,0 and 1.

theta <- c(-1,0,1) a <- 1 b <- 0 c <- 0 d <- 1; irt.3pl.basic(t=theta,a=a,b=b,c=c,d=d) [1] 0.1544653 0.5000000 0.8455347

Results are as expected. Examinee with ability -1 has a low probability of correctly answering this question. Reverse is true for examinee with high ability.

In the next step, I’ll graph item characteristic curve of an item with parameters a=0.7; b=0.5; c=0.2; d=.98:

theta <- seq(-4,4,by=.1) Probability <- irt.3pl.basic(t=theta,a=0.7, b=0.5, c=0.2, d=.98) plot(theta,Probability,type="l")

In the next plot I will extend this function to a multi item and multi ability case.

## References

Barton, M.A., & Lord, F.M. (1981). An Upper Asymptote for the Three-Parameter Logistic Item-Response Model. Arlington, Va.: Office of Naval Research, Personnel and Training Research Programs Office.