# simulate data with three stimuli of different difficulty.
# this implies different drift rates across conditions.
# define a time grid. A more reasonable stepsize is .01; this is just for speed.
tt = seq(0, 5, .1)
pars = c(.8, 2, .5, .5, .5, # condition 1
.8, 3, .5, .5, .5, # condition 2
.8, 4, .5, .5, .5) # condition 3
pdfND = dbeta(tt, 10, 30)
# simulate data
lst = simData(n = 3e5, pars = pars, tt = tt, pdfND = pdfND, return.pdf = TRUE)
dat = lst$dat
# define restriction matrix
restr = matrix(1:5, 5, 3)
restr[2, 2:3] = 6:7 # allow drift rates to differ
# fix variance parameters
fixed = matrix(c('sz1', .5, 'sv1', .5), 2, 2)
## Not run:
# # Run D*M analysis
# resD = estDstarM(dat = dat, tt = tt, restr = restr, fixed = fixed)
# # Estimate nondecision density
# resND = estND(resD)
# # Estimate observed density
# resObs = estObserved(resD, resND)
# # plot histograms with overlayed
# # densities per condition-response pair
# plotObserved(resObserved = resObs, data = dat,
# xlim = c(0, 1))
# # plot estimated and true densities
# plot(resObs, col = rep(1:3, each = 2), xlim = 0:1)
# matlines(tt, lst$pdfNormalized, col = rep(1:3, each = 2), lty = 2)
# ## End(Not run)
Run the code above in your browser using DataLab