diffIRT: Fitting diffusion IRT models

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/diffIRT.r

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

1
2
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 in x is also treated as missing and vice versa.

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 parameter in the model. Each parameter should be consecutively numbered from '1' onwards. Equality constraints can be imposed by giving two or more parameters the same number. Fixed parameter constraints can be imposed by putting 0's at the corresponding elements. The value to which those parameters should be fixed need then to be be specified in the start argument. The first 1 to nit elements in constrain correspond to the item boundary parameters (ai), the next nit elements correspond to the item drift parameters (vi[i]), the next nit elements correspond to the item non-decision time parameters (ter[i]), and the final 2 elements contain the population scale parameters of the person boundary distribution (omega[gamma]) and the person drift distribution (omega[theta]). Note that omega[gamma] and omega[theta] can be fixed to 0 to fit a model without random drift rates and random person boundaries respectively, see Examples. In the preprogrammed setups argument start should be either equal to "ai.equal", "vi.equal", "ter.equal", or "scale.equal" to equate respectively a[i], v[i], or Ter[i] across items or to equate omega[gamma] and omega[kappa]. See Details for more explanation on the parameters in the different models and see Examples for examples on constraining parameters.

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 the constrain argument. For each parameter a starting value can be provided. If NA, the starting value for that parameter is chosen automatically. If a parameter is submitted to a fixed value constraint in the constrain argument, the value of that parameter should be provided (i.e., an NA is not allowed). See Examples.

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

nq

Vector of any length containing the number of quadrature points that should be used in successive optimizations. Optimisation will start using the number of quadratures points specified in the first element. When converged, the resulting parameter estimates will be used as starting values in a new optimisation using the number of quadrature points from the second element. This process continues until the end of vector nq is reached. Default is c(7).

method

The optimisation method used by optim. Default "BFGS".

eps

Precision with which the infinite integral in the likelihood function is approximated. Default is 0.01. See Details.

delta

Precision used in the finite difference approximation of the gradient. Default is 1e-7.

trace

See optim for details and default.

fnscale

See optim for details and default.

parscale

See optim for details and default.

maxit

See optim for details. Default is 1999.

reltol

See optim for details and default.

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).

Value

An object of class diffIRT with values

start.val

starting values

par

parameter estimates

par.log

log-transformed parameters (note that for the D-diffusion model v[i] is not transformed, see Details.

std.err

if argument se equals T, it contains the standard errors of the parameters

totLL

value of -2 times the log-marginal likelihood at convergence

npars

number of parameters in the model

AIC

AIC

BIC

BIC

sBIC

sample size adjusted BIC

DIC

DIC

subjLL

a vector of size N containing the individual contribution of each subject to the marginal likelihood of the model.

hist

a 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).

conv

integer convergence status returned by optim

nr_fail

the 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.

Author(s)

Dylan Molenaar d.molenaar@uva.nl

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
 # 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))       


## End(Not run)

diffIRT documentation built on May 2, 2019, 4:51 a.m.

Related to diffIRT in diffIRT...