simulateRTConf | R Documentation |
Simulates the decision responses, reaction times and confidence measure
together with a discrete confidence judgment for the sequential sampling confidence model
specified by the argument model
, given specific parameter constellations.
This function is a wrapper that calls the respective functions for diffusion based
models (dynaViTE and 2DSD: simulateWEV
) and race models (IRM, PCRM,
IRMt, and PCRMt: simulateRM
. It also computes the Gamma rank correlation
between the confidence ratings and
condition (task difficulty), reaction times and accuracy in the simulated output.
simulateRTConf(paramDf, n = 10000, model = NULL, gamma = FALSE,
agg_simus = FALSE, simult_conf = FALSE, stimulus = c(1, 2),
delta = 0.01, maxrt = 15, seed = NULL)
paramDf |
a list or dataframe with one row with the required parameters. |
n |
integer. The number of samples (per condition and stimulus direction) generated.
Total number of samples is |
model |
character scalar. One of "dynaViTE", "dynWEV", "2DSD", "2DSDT", "DDConf", "IRM", "PCRM", "IRMt", or "PCRMt". Could also be passed as a column in the paramDf argument. |
gamma |
logical. If TRUE, the gamma correlation between confidence ratings, rt and accuracy is computed. |
agg_simus |
logical. Simulation is done on a trial basis with RTs outcome. If TRUE, the simulations will be aggregated over RTs to return only the distribution of response and confidence ratings. Default: FALSE. |
simult_conf |
logical. Whether in the experiment confidence was reported simultaneously
with the decision. If that is the case decision and confidence judgment are assumed to have happened
subsequent before the response. Therefore |
stimulus |
numeric vector. Either 1, 2 or c(1, 2) (default). Together with condition represents the experimental situation. In a 2AFC task the presented stimulus belongs to one of two categories. In the default setting trials with both categories presented are simulated but one can choose to simulate only trials with the stimulus coming from one category. |
delta |
numerical. Size of steps for the discretized simulation. |
maxrt |
numerical. Maximum reaction time to be simulated. Default: 15. |
seed |
numerical. Seeding for non-random data generation. (Also possible outside of the function.) |
The output of the fitting function fitRTConf
with the respective model
fits the argument paramDf
for simulation. The function calls the respective simulation
function for diffusion based models, i.e. dynaViTE and 2DSD (simulateWEV
) or race models,
i.e. IRM(t) and PCRM(t), (simulateRM
). See there for more information.
Simulation Method: The simulation is done by simulating normal variables in discretized steps until the processes reach the boundary. If no boundary is met within the maximum time, response is set to 0.
Gamma correlations: The Gamma coefficients are computed separately for correct/incorrect responses for the correlation of confidence ratings with condition and rt and separately for conditions for the correlation of accuracy and confidence. The resulting data frames in the output thus have two columns. One for the grouping variable and one for the Gamma coefficient.
Depending on gamma
and agg_simus
.
If gamma
is FALSE
, returns a data.frame
with columns: condition
,
stimulus
, response
, correct
, rt
, conf
(the continuous confidence
measure) and rating
(the discrete confidence rating) or
(if agg_simus=TRUE
): condition
, stimulus
,response
, correct
,
rating
and p
(for the probability of a response and rating, given
the condition and stimulus).
If gamma
is TRUE
, returns a list
with elements:
simus
(the simulated data frame) and gamma
, which is again a list
with elements
condition
, rt
and correct
, each a tibble
with two columns (see details for more
information).
Sebastian Hellmann.
# The function is particularly useful, when having a collection
# of parameter sets for different models (e.g. output by fitRTConfModels for
# more than one model).
library(dplyr)
# 1. Generate only one parameter set but for two different models
paramDf1 <- data.frame(model="dynWEV", a=1.5,v1=0.2, v2=1, t0=0.1,z=0.52,
sz=0.3,sv=0.4, st0=0, tau=3, w=0.5,
theta1=1, svis=0.5, sigvis=0.8)
paramDf2 <- data.frame(model="PCRMt", a=2,b=2, v1=0.5, v2=1, t0=0.1,st0=0,
wx=0.6, wint=0.2, wrt=0.2, theta1=4)
paramDf <- full_join(paramDf1, paramDf2)
paramDf # each model parameters sets hat its relevant parameters
# Split paramDf by model (maybe also other columns) and simulate data
simus <- paramDf |> group_by(model) |>
reframe(simulateRTConf(cbind(cur_group(), pick(everything())), n=200, simult_conf = TRUE))
head(simus)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.