Learn R Programming

diffIRT (version 1.5)

diffIRT: Fitting diffusion IRT models

Description

This function fits the D-diffusion or the Q-diffusion IRT model to response and response time data using marginal maximum likelihood. Item parameters that are estimated are item drift rate, v[i] item boundary separation, a[i], and item specific non-decision time, Ter[i]. Population parameters that are estimated are omega[gamma] and omega[theta], which are scale parameters for the person boundary separation and person drift rate respectively. Parameters can be submitted to equality and/or fixed value constraints.

Usage

diffIRT(rt, x, model="D", constrain=NULL,
        start=NULL, se=F, control=list())

Arguments

rt
A matrix of size N by nit containing the response times, where N is the number of subjects and nit is the number of items. NA's are allowed. If a given element in rt is NA, the corresponding element
x
A matrix of N by nit containing the responses. A's are allowed. If a given element in rt is NA, the corresponding element in x is also treated as missing and vice versa.
model
String; Either "D" to fit the D-diffusion IRT model or "Q" to fit the Q-diffusion IRT model.
constrain
If NULL, the unconstrained model is fitted. Otherwise, one could use a manual setup or a preprogrammed setup. In the manual setup a vector of length 3*nit+2 should be provided. Each element of this vector corresponds to a pa
start
If NULL the starting values are automatically chosen, see Details. Otherwise, a vector of length 3 x nit + 2 should be provided. Each element of this vector corresponds to a parameter from the model, similarly as in t
se
Logical; Denoting whether standard errors of the parameters should be estimated (this will increase computation time, default is F).
control
a list of control values for the optimizations

Value

  • An object of class diffIRT with values
  • start.valstarting values
  • parparameter estimates
  • par.loglog-transformed parameters (note that for the D-diffusion model v[i] is not transformed, see Details.
  • std.errif argument se equals T, it contains the standard errors of the parameters
  • totLLvalue of -2 times the log-marginal likelihood at convergence
  • nparsnumber of parameters in the model
  • AICAIC
  • BICBIC
  • sBICsample size adjusted BIC
  • DICDIC
  • subjLLa vector of size N containing the individual contribution of each subject to the marginal likelihood of the model.
  • hista matrix containing the history of the optimisation procedure. First row contains the starting values. Next rows contain the successive optimizations using the different number of quadrature points as specified in control. Final 4 columns contain LL (-2 times the log-marginal likelihood at convergence), converg (the convergence status returned by optim, func (the number of likelihood evaluations by optim), and gradient (the number of gradient evaluations by optim).
  • convinteger convergence status returned by optim
  • nr_failthe number of subjects for which the likelihood function was intractable (i.e., for these subjects, the log-likelihood approaches minus infinity). This could be due to the starting values, or due to extremely fast response times.

Details

diffIRT fits either the D-diffusion or the Q-diffusion IRT model to data by minimizing -2 times the log marginal likelihood function using optim. In the diffusion IRT model the traditional parameters from the diffusion model, boundary separation and drift rate are decomposed into person and item parameters (see van der Maas et al., 2011; Tuerlinckx & De Boeck, 2005). This results in: item boundary parameter $a[i]$, item drift parameter $v[i]$, person boundary $gamma[p]$, and person drift $theta[p]$. The model for the responses in the D-diffusion IRT model is then: $$logit(x[p,i]) = gamma[p]/a[i] x (theta[i]-v[i]),$$ where $gamma[p] >= 0$ and $ai[i] >= 0$. The Q-diffusion IRT model for the responses is given by: $$logit(x[p,i]) = gamma[p]/a[i] x (theta[p]/v[i]).$$ where $gamma[p] >= 0$, $a[i] >= 0$, $theta[p] >= 0$, and $theta[p] >= 0$. As discussed in van der Maas et al. (2011), this setup makes the D-diffusion IRT model suitable for personality data and the Q-diffusion IRT model for ability data. The response times follow a distribution according to a Wiener process which includes - in addition to the parameters above - a non-decision parameter for each item, $Ter[i]$. For the random effects, $theta[p]$ and $gamma[p]$ scale parameters are estimated which are respectively, $omega[gamma]$ and $omega[theta]$. The joint distribution of responses and response times is evaluated using the approach by Navarro & Fuss (2009). In this approach, the infinite sum in the density function of the diffusion model is being approximated with a maximum discrepancy of epsilon. This discrepancy can be set using the eps setting within the control argument. To facilitated numerical estimation, the natural logarithm of the parameters that are strictly positive are estimated (i.e., log(a[i]), log(Ter[i]), log(omega[gamma]), log(omega[theta]), and log(v[i]) in the Q-diffusion model). However, in the output the parameters are transformed back to their original scale. In addition, if se=T, standard errors for the original parameters are calculated from the standard errors of the transformed parameters using the delta method. Because gamma[p] and theta[p] in the Q-diffusion model and gamma[p] in the D-diffusion model can only be positive, their population distribution is assumed to be normal on the log-scale. As a consequence, gamma[p] and theta[p] follow a log-normal distribution. Thus, in the Q-diffusion model gamma[p] and theta[p] are log-normally distributed with scale parameters omega[gamma] and omega[theta] respectively. In case of the D-diffusion model, theta[p] is distributed log-normally with scale parameter omega[gamma], and theta[p] is distributed normally with scale parameter omega[theta] which equals the standard deviation. By default, starting values are calculated using the EZ-diffusion model (Wagemakers, van der Maas, & Grasman, 2007). For more details see Molenaar, Tuerlinkcx, & van der Maas (2013).

References

Molenaar, D., Tuerlinkcx, F., & van der Maas, H.L.J. (2015). Fitting Diffusion Item Response Theory Models for Responses and Response Times Using the R Package diffIRT. Journal of Statistical Software, 66(4), 1-34. URL http://www.jstatsoft.org/v66/i04/.

Navarro, D.J. & Fuss, I.G. (2009). Fast and accurate calculations for first-passagetimes in Wiener diffusion models. Journal of Mathematical Psychology, 53, 222-230.

Tuerlinckx, F., & De Boeck, P. (2005). Two interpretations of the discrimination parameter. Psychometrika, 70, 629-650.

van der Maas, H.L.J., Molenaar, D., Maris, G., Kievit, R.A., & Borsboom, D. (2011). Cognitive psychology meets psychometric theory: On the relation between process models for decision making and latent variable models for individual differences. Psychological Review, 118, 339-356.

Wagenmakers, E. J., Van Der Maas, H. L., & Grasman, R. P. (2007). An EZ-diffusion model for response time and accuracy. Psychonomic Bulletin & Review, 14, 3-22.

See Also

simdiff for simulating data according to the D-diffusion or Q-diffusion IRT model. factest for estimation of factor scores (person drift rate and person boundary separation). QQdiff and RespFit for model fit assessment. summary.diffIRT for a overview of the model estimation results, including model fit statistics. anova.diffIRT to conduct a likelihood ratio test between two nested diffIRT models. coef.diffIRT to extract parameter estimates.

Examples

Run this code
# open extraversion data
data(extraversion)
x=extraversion[,1:10]
rt=extraversion[,11:20]
 
# fit an unconstrained D-diffusion model
res1=diffIRT(rt,x,model="D")          
         
# fit a model with equal item boundaries, a[i] using the manual setup
res2=diffIRT(rt,x,model="D",
  constrain=c(rep(1,10),2:11,12:21,22,23)) 

# fit a model with equal item boundaries, a[i] using the preprogrammed setup
res2=diffIRT(rt,x,model="D",
  constrain="ai.equal") 

# fit a model where all item drift parameters,vi, are fixed to 0. 
res3=diffIRT(rt,x,model="D",
  constrain=c(1:10,rep(0,10),11:20,21,22),
  start=c(rep(NA,10),rep(0,10),rep(NA,10),NA,NA))       

# fit a model without random person boundary parameters. 
res3=diffIRT(rt,x,model="D",
  constrain=c(1:30,0,31),
  start=c(rep(NA,30),0,NA))

Run the code above in your browser using DataLab