SimSST Examples

Mohsen Soltanifar

2022-12-09

SimSST

The goal of SimSST is to simulate stop signal task data based on fixed ssd method and the tracking method.

Installation

You can install the development version of descfarspkg with:

library(dplyr)
#> Warning: package 'dplyr' was built under R version 4.1.3
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(gamlss.dist)
#> Warning: package 'gamlss.dist' was built under R version 4.1.3
#> Loading required package: MASS
#> Warning: package 'MASS' was built under R version 4.1.3
#> 
#> Attaching package: 'MASS'
#> The following object is masked from 'package:dplyr':
#> 
#>     select
library(SimSST)
set.seed(1)

Example 1. Paper: Fixed SSD method-based Simulation

mySSTdata1 <- 
  simssfixed(
    pid=c("FNLN1","FNLN1"),
    block = c(1,2), 
    n=c(10,10), m=c(4,4), SSD.b=c(220,240),
    dist.go=c("ExG","ExG"),
    theta.go=as.matrix(rbind(c(440,90,90),c(440,90,90))),
    dist.stop=c("ExG","ExG"),
    theta.stop=as.matrix(rbind(c(120,80,70),c(120,80,70))))
mySSTdata1 
#>       Participant.id Block Trial  Inhibition GORT    SSRT    SRRT    SSD   
#>  [1,] "FNLN1"        "1"   "Go"   "-999"     "558.2" "-999"  "-999"  "-999"
#>  [2,] "FNLN1"        "1"   "Go"   "-999"     "426.8" "-999"  "-999"  "-999"
#>  [3,] "FNLN1"        "1"   "Go"   "-999"     "354.3" "-999"  "-999"  "-999"
#>  [4,] "FNLN1"        "1"   "Stop" "1"        "-999"  "104.6" "-999"  "220" 
#>  [5,] "FNLN1"        "1"   "Go"   "-999"     "745.3" "-999"  "-999"  "-999"
#>  [6,] "FNLN1"        "1"   "Go"   "-999"     "568.7" "-999"  "-999"  "-999"
#>  [7,] "FNLN1"        "1"   "Go"   "-999"     "689.8" "-999"  "-999"  "-999"
#>  [8,] "FNLN1"        "1"   "Stop" "1"        "-999"  "94.7"  "-999"  "220" 
#>  [9,] "FNLN1"        "1"   "Stop" "1"        "-999"  "232.3" "-999"  "220" 
#> [10,] "FNLN1"        "1"   "Stop" "1"        "-999"  "153.8" "-999"  "220" 
#> [11,] "FNLN1"        "2"   "Go"   "-999"     "493.2" "-999"  "-999"  "-999"
#> [12,] "FNLN1"        "2"   "Go"   "-999"     "636.1" "-999"  "-999"  "-999"
#> [13,] "FNLN1"        "2"   "Go"   "-999"     "591.7" "-999"  "-999"  "-999"
#> [14,] "FNLN1"        "2"   "Go"   "-999"     "385.1" "-999"  "-999"  "-999"
#> [15,] "FNLN1"        "2"   "Stop" "0"        "-999"  "195.7" "420.9" "240" 
#> [16,] "FNLN1"        "2"   "Stop" "1"        "-999"  "189.8" "-999"  "240" 
#> [17,] "FNLN1"        "2"   "Go"   "-999"     "564.1" "-999"  "-999"  "-999"
#> [18,] "FNLN1"        "2"   "Stop" "1"        "-999"  "267.2" "-999"  "240" 
#> [19,] "FNLN1"        "2"   "Go"   "-999"     "622.3" "-999"  "-999"  "-999"
#> [20,] "FNLN1"        "2"   "Stop" "1"        "-999"  "264.7" "-999"  "240"

Example 2.Paper: Tracking Method-based Simulation

mySSTdata2 <- 
  simsstrack(
    pid=c("FNLN1","FNLN1"),
    block=c(1,2), 
    n=c(10,10), m=c(4,4), SSD.b=c(220,240), 
    dist.go=c("ExG","ExG" ),
    theta.go=as.matrix(rbind(c(440,90,90),c(440,90,90))),
    dist.stop=c("ExG","ExG" ),
    theta.stop=as.matrix(rbind(c(120,80,70),c(120,80,70))))
mySSTdata2
#>       Participant.id Block Trial  Inhibition GORT    SSRT    SRRT    SSD   
#>  [1,] "FNLN1"        "1"   "Stop" "0"        "-999"  "319.4" "446.6" "220" 
#>  [2,] "FNLN1"        "1"   "Go"   "-999"     "670.7" "-999"  "-999"  "-999"
#>  [3,] "FNLN1"        "1"   "Stop" "1"        "-999"  "302.1" "-999"  "170" 
#>  [4,] "FNLN1"        "1"   "Go"   "-999"     "472"   "-999"  "-999"  "-999"
#>  [5,] "FNLN1"        "1"   "Stop" "1"        "-999"  "155.2" "-999"  "220" 
#>  [6,] "FNLN1"        "1"   "Go"   "-999"     "646.7" "-999"  "-999"  "-999"
#>  [7,] "FNLN1"        "1"   "Stop" "0"        "-999"  "262.5" "370.8" "270" 
#>  [8,] "FNLN1"        "1"   "Go"   "-999"     "474.3" "-999"  "-999"  "-999"
#>  [9,] "FNLN1"        "1"   "Go"   "-999"     "470.5" "-999"  "-999"  "-999"
#> [10,] "FNLN1"        "1"   "Go"   "-999"     "512"   "-999"  "-999"  "-999"
#> [11,] "FNLN1"        "2"   "Stop" "0"        "-999"  "270.3" "427.2" "240" 
#> [12,] "FNLN1"        "2"   "Go"   "-999"     "402.8" "-999"  "-999"  "-999"
#> [13,] "FNLN1"        "2"   "Stop" "1"        "-999"  "171.4" "-999"  "190" 
#> [14,] "FNLN1"        "2"   "Go"   "-999"     "440.4" "-999"  "-999"  "-999"
#> [15,] "FNLN1"        "2"   "Stop" "0"        "-999"  "160.2" "392.4" "240" 
#> [16,] "FNLN1"        "2"   "Go"   "-999"     "351.9" "-999"  "-999"  "-999"
#> [17,] "FNLN1"        "2"   "Stop" "0"        "-999"  "276"   "442.4" "190" 
#> [18,] "FNLN1"        "2"   "Go"   "-999"     "562.5" "-999"  "-999"  "-999"
#> [19,] "FNLN1"        "2"   "Go"   "-999"     "671.4" "-999"  "-999"  "-999"
#> [20,] "FNLN1"        "2"   "Go"   "-999"     "615"   "-999"  "-999"  "-999"

To convert tracking-based SimSST simulated data to BEESTS software input data, we have:

Example: Converstion to BEESTs software format

Datatemp2<-mySSTdata2 
ss_presented<-recode(Datatemp2[,3], 'Stop' = "1", 'Go' = "0")
inhibited<-Datatemp2[,4]
ssd<-Datatemp2[,8]
rt<-Datatemp2[,5]
srrt<-Datatemp2[,7]
Data2<-cbind.data.frame(ss_presented, inhibited, ssd, rt, srrt)
for(i in 1:20)  if(Data2$inhibited[i]==0) Data2$rt[i] <- Data2$srrt[i]  
myBEESTSdata2 <- (Data2[,-5])[order(ss_presented),]
myBEESTSdata2
#>    ss_presented inhibited  ssd    rt
#> 2             0      -999 -999 670.7
#> 4             0      -999 -999   472
#> 6             0      -999 -999 646.7
#> 8             0      -999 -999 474.3
#> 9             0      -999 -999 470.5
#> 10            0      -999 -999   512
#> 12            0      -999 -999 402.8
#> 14            0      -999 -999 440.4
#> 16            0      -999 -999 351.9
#> 18            0      -999 -999 562.5
#> 19            0      -999 -999 671.4
#> 20            0      -999 -999   615
#> 1             1         0  220 446.6
#> 3             1         1  170  -999
#> 5             1         1  220  -999
#> 7             1         0  270 370.8
#> 11            1         0  240 427.2
#> 13            1         1  190  -999
#> 15            1         0  240 392.4
#> 17            1         0  190 442.4

Once users reformat the simulated datasets to BEESTS dataset format, they may feed the BEESTS data to the BEESTS software to compute their plausible parameters (mu, sigma, tau).