Title: | Diffusion IRT Models for Response and Response Time Data |
---|---|
Description: | Package to fit diffusion-based IRT models to response and response time data. Models are fit using marginal maximum likelihood. Parameter restrictions (fixed value and equality constraints) are possible. In addition, factor scores (person drift rate and person boundary separation) can be estimated. Model fit assessment tools are also available. The traditional diffusion model can be estimated as well. |
Authors: | Dylan Molenaar |
Maintainer: | Dylan Molenaar <[email protected]> |
License: | GPL-2 |
Version: | 1.5 |
Built: | 2024-12-02 06:32:11 UTC |
Source: | CRAN |
diffIRT
modelsUsing this function, a likelihood ratio test is conducted on two nested diffIRT
model. Results are
printed to the screen togheter with the AIC, BIC, sample size adjusted BIC, and DIC comparative fit indices for both models.
## S3 method for class 'diffIRT' anova(object, object2, ...)
## S3 method for class 'diffIRT' anova(object, object2, ...)
object |
a |
object2 |
a |
... |
additional parameters, currently not used. |
Dylan Molenaar [email protected]
diffIRT for fitting diffusion IRT models.
## Not run: # simulate data according to a D-diffusion model # with equal a[i] parameters data=simdiff(100,10, ai=rep(.3,10),vi=seq(-1,1,length=10),ter=runif(10,2,3), gamma=rlnorm(100,0,.3),theta=rnorm(100,0,.5), model="D") # fit a full D-diffusion model res=diffIRT(data$rt,data$x,model="D") # fit a D-diffusion model subject to an # equality constraint across all a[i] parameters res2=diffIRT(data$rt,data$x,model="D",constrain=c(rep(1,10),2:21,22,23)) # use the anova function to conduct the likelihood ratio test anova(res2,res) ## End(Not run)
## Not run: # simulate data according to a D-diffusion model # with equal a[i] parameters data=simdiff(100,10, ai=rep(.3,10),vi=seq(-1,1,length=10),ter=runif(10,2,3), gamma=rlnorm(100,0,.3),theta=rnorm(100,0,.5), model="D") # fit a full D-diffusion model res=diffIRT(data$rt,data$x,model="D") # fit a D-diffusion model subject to an # equality constraint across all a[i] parameters res2=diffIRT(data$rt,data$x,model="D",constrain=c(rep(1,10),2:21,22,23)) # use the anova function to conduct the likelihood ratio test anova(res2,res) ## End(Not run)
The data are simulated according to a design similar as that of a real
brightness discrimination experiment by Ratcliff & Rouder (1998). In this experiment,
the subject had to decide for a number of trials whether the brightness of a
stimulus (a randomly generated array of pixels displayed on a computer screen)
was either 'high' or 'low'. The true
brightness of the stimuli were manipulated into a number of levels and
administered with a speed instruction ("respond as fast as possible") and
with an accuracy instruction ("respond as accurate as possible").
Present dataset was simulated according to a design with 6 different brightness levels and
2 speed instructions resulting in 12 conditions. In the brightness data matrix,
the first 12 columns are the responses and the next 12 columns are the response times.
Each trial is assigned to a separate row with the response time of that trial in
the corresponding column and NA
's on the remaining columns. Similarly
for the responses. In addition, the data are arranged in such a way that the
first 6 conditions are the speed instructed stimuli and the next 6 conditions
are the corresponding accuracy instructed versions of these stimuli. See below for
an example how to analyse these data using the diffIRT package (taken from
Molenaar, Tuerlinckx, & van der Maas, 2015).
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/.
Ratcliff, R., & Rouder, J. N. (1998). Modeling response times for two-choice decisions. Psychological Science, 9(5), 347-356.
data(brightness) x=brightness[,1:12] rt=brightness[,13:24] ## Not run: res = diffIRT(rt,x,model="D",constrain=c(rep(1,6), rep(2,6),3:8,3:8,rep(9,12),0,10), start=c(rep(NA,36),0,NA)) ## End(Not run)
data(brightness) x=brightness[,1:12] rt=brightness[,13:24] ## Not run: res = diffIRT(rt,x,model="D",constrain=c(rep(1,6), rep(2,6),3:8,3:8,rep(9,12),0,10), start=c(rep(NA,36),0,NA)) ## End(Not run)
Returns estimated item and population parameters from a diffIRT
object
## S3 method for class 'diffIRT' coef(object, ...)
## S3 method for class 'diffIRT' coef(object, ...)
object |
a |
... |
additional parameters, currently not used. |
Returns a list with two entries:
item |
the estimated item parameters, item boundary ( |
pop |
the estimated population parameters, omega_ap and omega_vp. |
Dylan Molenaar [email protected]
diffIRT for fitting diffusion IRT models.
## Not run: # simulate data accroding to D-diffusion IRT model data=simdiff(N=100,nit=10,model="D") # fit the D-diffusion IRT model res1=diffIRT(data$rt,data$x) # extract parameter estimates coef(res1) ## End(Not run)
## Not run: # simulate data accroding to D-diffusion IRT model data=simdiff(N=100,nit=10,model="D") # fit the D-diffusion IRT model res1=diffIRT(data$rt,data$x) # extract parameter estimates coef(res1) ## End(Not run)
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.
diffIRT(rt, x, model="D", constrain=NULL, start=NULL, se=F, control=list())
diffIRT(rt, x, model="D", constrain=NULL, start=NULL, se=F, control=list())
rt |
A matrix of size |
x |
A matrix of |
model |
String; Either "D" to fit the D-diffusion IRT model or "Q" to fit the Q-diffusion IRT model. |
constrain |
If |
start |
If |
se |
Logical; Denoting whether standard errors of the parameters should be estimated (this will increase computation time, default is |
control |
a list of control values for the optimizations |
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).
The optimisation method used by optim
. Default "BFGS".
Precision with which the infinite integral in the likelihood function is approximated. Default is 0.01. See Details.
Precision used in the finite difference approximation of the gradient. Default is 1e-7.
See optim
for details and default.
See optim
for details and default.
See optim
for details and default.
See optim
for details. Default is 1999.
See optim
for details and default.
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 , item drift parameter
,
person boundary
, and person drift
. The model
for the responses in the D-diffusion IRT model is then:
where and
. The Q-diffusion IRT model for the
responses is given by:
where ,
,
, and
.
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,
. For the random effects,
and
scale parameters are estimated
which are respectively,
and
. 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).
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 |
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 |
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 |
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. |
Dylan Molenaar [email protected]
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.
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.
## 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)
## 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)
These data comprise responses (first 10 columns labelled 'X[]') and response times (next 10 columns labelled 'T[]') of 146 subjects to 10 extraversion items with a binary answer scale. Each item consists of a particular habit, e.g., 'active' and 'noisy'. Subjects were asked to indicate whether (yes/no) these habits are applicable to their personalities. Response times are in seconds.
The specific habits for the 10 items are (translated from Dutch):
'active'
'noisy'
'energetic'
'enthusiastic'
'impulsive'
'jovial'
'viable'
'eupeptic'
'communicative'
'spontaneous'
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/.
data(extraversion) x=extraversion[,1:10] # responses, 0 for 'no', 1 for 'yes' rt=extraversion[,11:20] # response times in seconds
data(extraversion) x=extraversion[,1:10] # responses, 0 for 'no', 1 for 'yes' rt=extraversion[,11:20] # response times in seconds
This function estimates the person drift rate and person boundary separation for diffIRT
objects.
factest(object,start=NULL,se=F, control=list())
factest(object,start=NULL,se=F, control=list())
object |
A |
start |
If |
se |
Logical; Denoting whether standard errors of the parameters should be estimated (can be time consuming, therefore, default is |
control |
a list of control values for the optimisation |
The optimisation method used by optim
. Default "BFGS".
See optim
for details and default.
See optim
for details and default.
See optim
for details and default.
See optim
for details and default.
See optim
for details and default.
See optim
for details. Default is 1999.
See optim
for details and default.
factest
returns empirical Bayes estimates of the person drift rate and
the person boundary separation. See diffIRT for more explanation concerning the parameters in the
D-diffusion and Q-diffusion IRT model.
Function factest
returns a matrix of parameter estimates and - if se
=T - standard errors.
Dylan Molenaar [email protected]
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.
diffIRT
for fitting diffusion IRT models.
simdiff
for simulating data according to the D-diffusion or Q-diffusion IRT model.
QQdiff
and RespFit for model fit assesment.
## Not run: # simulate data accroding to D-diffusion model data=simdiff(N=100,nit=10,model="D") # fit an unconstrained model res1=diffIRT(data$rt,data$x,model="D") # estimate factor scores fs=factest(res1) ## End(Not run)
## Not run: # simulate data accroding to D-diffusion model data=simdiff(N=100,nit=10,model="D") # fit an unconstrained model res1=diffIRT(data$rt,data$x,model="D") # estimate factor scores fs=factest(res1) ## End(Not run)
This function plots the observed response times against the predicted response times for a diffIRT
object.
QQdiff(object, items, plot=2, breaks=15, quant=NULL, maxRT=NULL)
QQdiff(object, items, plot=2, breaks=15, quant=NULL, maxRT=NULL)
object |
A |
items |
A vector denoting for which items the QQ-plots need to be created. |
plot |
Integer; 1: only QQ-plots. 2: both a QQ-plot and a histogram containing the predicted and observed distribution. |
breaks |
Number of breaks to be used in hist when |
quant |
The number of quantiles to be used. If |
maxRT |
The maximum response time used in finding the quantiles of the theoretical distribution. If |
QQdiff
calculates the predicted quantiles in the marginal response time distribution of the given
model (D-diffusion or Q-diffusion).
Function QQdiff
returns a list with entries:
qexp |
a vector with predicted quantiles. |
qobs |
a vector with observed quantiles. |
Dylan Molenaar [email protected]
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.
diffIRT
for fitting diffusion IRT models.
factest
for estimation of factor scores (person drift rate and person boundary separation).
simdiff
for simulating data according to the D-diffusion or Q-diffusion IRT model.
## Not run: # open rotation data data(rotation) x=rotation[,1:10] rt=rotation[,11:20] # fit an unconstrained Q-diffusion model res1=diffIRT(rt,x,model="Q") # make QQ-plots and histograms for items 1 to 4. QQdiff(res1, items=1:4, plot=2, maxRT=rep(50,4)) ## End(Not run)
## Not run: # open rotation data data(rotation) x=rotation[,1:10] rt=rotation[,11:20] # fit an unconstrained Q-diffusion model res1=diffIRT(rt,x,model="Q") # make QQ-plots and histograms for items 1 to 4. QQdiff(res1, items=1:4, plot=2, maxRT=rep(50,4)) ## End(Not run)
This function uses the procedure by Maydeu-Olivares & Joe (2005) to asses the goodness-of-fit of the responses
from a diffIRT
object.
RespFit(object, order=2)
RespFit(object, order=2)
object |
A |
order |
Integer; The order of the moments to be compared see details. |
RespFit
is an implementation of the method outlined in Maydeu-Olivares & Joe (2005). The traditional Pearson
chi-square method are sub optimal in this case because in common IRT settings, contingency tables tend to be sparse. This
causes the asymptotic distribution of the traditional test statistic to depart from its theoretical distribution. In
the method proposed by Maydeu-Olivares & Joe, this problem is overcome by focussing on the first r
moments (specified in order
) of the observed and predicted response distributions. Choosing order
to be equal to the number of items will result in the traditional chi-square test statistic. Commonly
order
is chosen to be small (e.g., 1 or 2).
Returns an object of class RespFit
with entries:
Z |
A matrix with predicted statistics, observed statistics, and Z-values |
Mr |
The test statistic. |
df |
Degrees of freedom. |
order |
Order of the test statistic. |
For large numbers of items, this test becomes computationally infeasible.
The degrees of freedom for the test statistic differ between the D-diffusion and Q-diffusion model as for the
Q-diffusion model, and
are not simultaneously identified in response data only. See Molenaar, Tuerlinckx, & van der Maas (2013)
for more details.
Dylan Molenaar [email protected]
Maydeu-Olivares, A., & Joe, H. (2005). Limited and full information estimation and testing in 2n contingency tables: A unified framework. Journal of the American Statistical Association, 100, 1009-1020.
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/.
QQdiff
for model fit assessment of the response times.
diffIRT
for fitting diffusion IRT models.
factest
for estimation of factor scores (person drift rate and person boundary separation).
simdiff
for simulating data according to the D-diffusion or Q-diffusion IRT model.
## 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") # Conduct the limited-information test RespFit(res1, 2) ## End(Not run)
## 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") # Conduct the limited-information test RespFit(res1, 2) ## End(Not run)
These data comprise responses (first 10 columns labelled 'X[]') and response times (next 10 columns labelled 'T[]') of 121 subjects to 10 binary mental rotation items. The data are part of the paper by van der Maas et al (2011). These data are taken from a larger database published in Kievit (2010; see also Borst, Kievit, Thompson, & Kosslyn, 2011). Each item consists of a graphical display of two 3-dimensional objects. The second object was either a rotated version of the first object, or a rotated version of a different object. Subjects were asked whether the second object was the same as the first object (yes/no). The degree of rotation of the second object was either 50, 100, or 150 degrees. Answers are coded to be correct (1) or false (0). Response times were recorded in seconds.
The specific rotation angles of the different items are:
'150'
'50'
'100'
'150'
'50'
'100'
'150'
'50'
'150'
'100'
Borst, G., Kievit, R. A., Thompson, W. L., & Kosslyn, S. M. (2011). Mental rotation is not easily cognitively penetrable. Journal of Cognitive Psychology, 23, 60-75.
Kievit, R. A. (2010). Representational inertia: The influence of associative knowledge on 3D mental transformations. Unpublished manuscript, Department of Psychology, University of Amsterdam, The Netherlands.
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/.
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.
data(rotation) x=rotation[,1:10] # responses, 0 for 'false', 1 for 'correct' rt=rotation[,11:20] # response times in seconds
data(rotation) x=rotation[,1:10] # responses, 0 for 'false', 1 for 'correct' rt=rotation[,11:20] # response times in seconds
This function simulates responses and response time data according to the D-diffusion or Q-diffusion IRT model.
simdiff(N,nit,ai=NULL,vi=NULL,gamma=NULL,theta=NULL,ter=NULL, model="D",max.iter=19999,eps=1e-15)
simdiff(N,nit,ai=NULL,vi=NULL,gamma=NULL,theta=NULL,ter=NULL, model="D",max.iter=19999,eps=1e-15)
N |
number of subjects. |
nit |
number of items. |
ai |
a vector of length |
vi |
a vector of length |
gamma |
a vector of length |
theta |
a vector of length |
ter |
a vector of length |
model |
string; Either "D" to fit the D-diffusion IRT model or "Q" to fit the Q-diffusion IRT model. |
max.iter |
maximum number of iterations for the rejection algorithm. See Details. |
eps |
convergence criterion for the rejection algorithm. See Details |
Function simdiff
is an extension of the rejection algorithm outlined in Tuerlinckx et al. (2001). In this algorithm,
a proposal response time is sampled from an exponential distribution. This proposal is accepted as actual response
time when a specific condition is satisfied (see Eq. 16 in Tuerlinckx, 2001). As this condition requires the
approximation of an infinite sum, a convergence criterion needs to be specified (see the argument eps
). When
the condition is not satisfied, a new proposal response time is sampled. This is repeated until the proposal response
time is accepted or when max.iter
has been reached.
Returns a list with the following entries:
rt |
the simulated matrix of response times |
x |
the simulated matrix of responses |
ai |
true values for |
vi |
true values for |
gamma |
true values for |
theta |
true values for |
ter |
true values for |
Dylan Molenaar [email protected]
Tuerlinckx, F., Maris, E., Ratcliff, R., & De Boeck, P. (2001). A comparison of four methods for simulating the diffusion process. Behavior Research Methods, Instruments & Computers, 33, 443-456.
diffIRT
for fitting diffusion IRT models.
## Not run: # simulate data accroding to D-diffusion model data=simdiff(N=100,nit=10,model="D") ## End(Not run)
## Not run: # simulate data accroding to D-diffusion model data=simdiff(N=100,nit=10,model="D") ## End(Not run)
This function simulates responses and response time data according to the traditional diffusion model for a single subject on a given number of trails. The parameters of the traditional diffusion model include: boundary separation, mean drift rate, standard deviation of drift rate, variance of the process, and ter.
simdiffT(N,a,mv,sv,ter,vp,max.iter=19999,eps=1e-15)
simdiffT(N,a,mv,sv,ter,vp,max.iter=19999,eps=1e-15)
N |
number of trails. |
a |
boundary separation. |
mv |
mean of the normally distributed drift rates across trails. |
sv |
standard deviation of the normally distributed drift rate across trails. |
ter |
non-decision time. |
vp |
variance of the process, which is a scaling parameter. Default equals 1. |
max.iter |
Maximum number of iterations for the rejection algorithm. See Details. |
eps |
Convergence criterion for the rejection algorithm. See Details |
Function simdiffT
is an application of the rejection algorithm outlined in Tuerlinckx et al. (2001) subject
to normally distributed inter-trail variability in drift. In this algorithm, a proposal response time is sampled
from an exponential distribution. This proposal is accepted as actual response time when a specific condition is
satisfied (see Eq. 16 in Tuerlinckx, 2001). As this condition requires the approximation of an infinite sum,
a convergence criterion needs to be specified (see the argument eps
). When the condition is not satisfied,
a new proposal response time is sampled. This is repeated until the proposal response time is accepted or when
max.iter
has been reached.
Returns a list with the following entries:
rt |
the simulated matrix of response times |
x |
the simulated matrix of responses |
Dylan Molenaar [email protected]
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/.
Tuerlinckx, F., Maris, E., Ratcliff, R., & De Boeck, P. (2001). A comparison of four methods for simulating the diffusion process. Behavior Research Methods, Instruments & Computers, 33, 443-456.
diffIRT
for fitting diffusion IRT models.
## Not run: # simulate data accroding to the traditional diffusion model set.seed(1310) a=2 v=1 ter=2 sdv=.3 N=10000 data=simdiffT(N,a,v,sdv,ter) rt=data$rt x=data$x # fit the traditional diffusion model (i.e., a restricted D-diffusion model, # see application 3 of the paper by Molenaar et al., 2013) diffIRT(rt,x,model="D",constrain=c(1,2,3,0,4),start=c(rep(NA,3),0,NA)) # this constrained model is a traditional diffusion model # please note that the estimated a[i] value = 1/a # and that the estimated v[i] value = -v ## End(Not run)
## Not run: # simulate data accroding to the traditional diffusion model set.seed(1310) a=2 v=1 ter=2 sdv=.3 N=10000 data=simdiffT(N,a,v,sdv,ter) rt=data$rt x=data$x # fit the traditional diffusion model (i.e., a restricted D-diffusion model, # see application 3 of the paper by Molenaar et al., 2013) diffIRT(rt,x,model="D",constrain=c(1,2,3,0,4),start=c(rep(NA,3),0,NA)) # this constrained model is a traditional diffusion model # please note that the estimated a[i] value = 1/a # and that the estimated v[i] value = -v ## End(Not run)
Summarizes the modeling results of a diffIRT object.
## S3 method for class 'diffIRT' summary(object, digits=3, ...)
## S3 method for class 'diffIRT' summary(object, digits=3, ...)
object |
a |
digits |
integer; number of decimal places the output is rounded to. |
... |
additional parameters, currently not used. |
Parameter estimates are displayed, including the standard errors if these have been estimated (see the se
argument of diffIRT
. In addition, -2 times the log-likelihood function, AIC, BIC, sample size adjusted
BIC, and DIC, are provided.
Dylan Molenaar [email protected]
diffIRT
for fitting diffusion IRT models.
## Not run: # simulate data according to D-diffusion model data=simdiff(N=100,nit=10,model="D") # fit a D-diffusion model res=diffIRT(data$rt,data$x,model="D") # use the summary function to obtain modeling results summary(res) ## End(Not run)
## Not run: # simulate data according to D-diffusion model data=simdiff(N=100,nit=10,model="D") # fit a D-diffusion model res=diffIRT(data$rt,data$x,model="D") # use the summary function to obtain modeling results summary(res) ## End(Not run)