Model definition in DDModeling is straightforward using the DDModel function.
DSTP_M1 <- DDModel(model="DSTP",task="flanker",
CDF_perc = c(0.1,0.3,0.5,0.7,0.9),CAF_perc = c(0.0,0.2,0.4,0.6,0.8,1.0))Note that the function can be used with specific task presets (as of DDModeling 0.0.1.0 only flanker is available), which will lessen the needed input of the function tremendously. Since DDModel returns a S4-class object, you can access (and modify by override) it’s slots by using the “@” operator. For explaination of the slots please see the DDModel-class help.
The function Sim_DDModel will generate model simulations (as of DDModeling 0.0.1.0 this will only return a simulation for a randomly drawn parameterset of the domain specified in the model).
Suppose you did an experiment and want to fit the data to your model. Here is what needs to be done.
For demonstraion purposes the DDModeling package includes a dataset called FLANKER_DATA which constitudes 64 subjects who were part of a flanker task experiment. We will now use one of these samples:
Then we can generate a representation (i.e. CDF/CAF) from this by using the DDRep function.
Subj1_Rep <- DDRep(model = DSTP_M1,raw = Subj1)
Subj1_Rep
#> CDF:
#> $Cong
#> cond perc time N
#> 1 Cong 0.1 294 22
#> 2 Cong 0.3 335 68
#> 3 Cong 0.5 365 114
#> 4 Cong 0.7 416 159
#> 5 Cong 0.9 516 205
#>
#> $Incong
#> cond perc time N
#> 1 Incong 0.1 286 26
#> 2 Incong 0.3 330 78
#> 3 Incong 0.5 364 131
#> 4 Incong 0.7 403 184
#> 5 Incong 0.9 469 236
#>
#>
#> CAF:
#> $Cong
#> cond perc time acc N_A N_B
#> 1 Cong 0.1 277 0.468750 30 34
#> 2 Cong 0.3 321 0.625000 40 24
#> 3 Cong 0.5 354 0.859375 55 9
#> 4 Cong 0.7 403 0.781250 50 14
#> 5 Cong 0.9 523 0.828125 53 11
#>
#> $Incong
#> cond perc time acc N_A N_B
#> 1 Incong 0.1 272 0.750000 48 16
#> 2 Incong 0.3 320 0.718750 46 18
#> 3 Incong 0.5 355 0.828125 53 11
#> 4 Incong 0.7 397 0.906250 58 6
#> 5 Incong 0.9 502 0.906250 58 6
#>
#>
#> Parameter:
#> Ter a c mu_t mu_f mu_RS2 mu_SS
#> 1 0 0 0 0 0 0 0Note that in order for this to work, your data (i.e. Subj1) has to be formated in a very specific way! Make sure that your data
DDModeling uses a combination of grid-search and downhill simplex in order to fit a given model. Therefore there is a need to calculate a grid before fitting. This can be done with the Generate_GRID function:
Several notes for this functions are needed:
Finally we can fit the data using the Fit_DDModel function
Subj1_Fit <- Fit_DDModel(model = DSTP_M1,rep = Subj1_Rep,grid_path = Grid1,s_sampling=FALSE,trials=10000)There are several things to note here, which will be discussed with further development.