Skip to content
Open
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ffc7094
add: Sequential Sampling Model, Evidence Accumulation Simulation
Zooaal Feb 13, 2025
0324d96
update: major fixes
Zooaal Feb 19, 2025
a0f9253
Update src/component.jl
Zooaal Feb 25, 2025
ff43378
Update src/component.jl
Zooaal Feb 25, 2025
115bd41
Apply suggestions from code review
Zooaal Feb 25, 2025
6d0e09e
Apply suggestions from code review
Zooaal Feb 25, 2025
cf1a757
fixture from code review
Zooaal Feb 25, 2025
7bdc931
Update DriftComponent to use max_length instead of an time vector
Zooaal Feb 26, 2025
844262e
changed two KellyModel Parameter names
Zooaal Feb 28, 2025
c524e9b
Update CITATION.cff
jschepers Feb 20, 2025
0da7b23
Change citation title to paper title
jschepers Feb 21, 2025
e3e8e54
added joss badge to readme
jschepers Mar 18, 2025
46d3e28
Edit citation section in README
jschepers Mar 18, 2025
ae90422
Add BibTeX entry to readme
jschepers Mar 18, 2025
af929ef
Format citation section in README
jschepers Mar 18, 2025
8de419c
Format citation section in README
jschepers Mar 18, 2025
3974473
Minor change
jschepers Mar 20, 2025
9a7b332
Fix and update CITATION.cff file
jschepers Mar 25, 2025
1c35c8d
Add JOSS paper as preferred citation
jschepers Mar 25, 2025
f020998
Apply basic suggestions from code review
Zooaal Apr 3, 2025
e68c5dc
Update from code review
Zooaal Apr 14, 2025
82834d2
Apply suggestions from code review
Zooaal Apr 20, 2025
9c0cdf7
add onset transform to Int and comment on Kelly Model String Fields
Zooaal Apr 23, 2025
b0500b0
v0.4.1 - compat DSP and SignalAnalysis
behinger May 13, 2025
2e23679
merge
behinger May 16, 2025
dae4cc9
Kelly Model is no longer exported, fix
behinger May 16, 2025
0e2657a
added SequentialSamplingModels to docs
behinger May 16, 2025
d48031c
Update CI.yml to run CI for PR on all branches not just main
jschepers Jun 10, 2025
3ccfa77
Update unfold family table & redirect doc links
xuyg16 Apr 26, 2025
192f7b3
Update CI.yml
behinger Jan 10, 2025
acec4ff
Update CI.yml
behinger Jan 10, 2025
07cc43a
merged tutorials, added Truncated, added urgency signal
behinger Jun 13, 2025
ba1ee0b
merge main
behinger Jun 13, 2025
04460ce
fix merge conflict remainder in tests
behinger Jun 13, 2025
d1ff5e8
added empty docstrings to abstracttypes
behinger Jun 13, 2025
bfa3e80
fix tests, added warning tau=0, export KellyModel,LBA,DDM
behinger Jun 14, 2025
4a042b8
oops forgot to save
behinger Jun 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
- main
tags: '*'
pull_request:
branches:
- main
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
Expand Down Expand Up @@ -59,3 +57,10 @@ jobs:
using UnfoldSim
DocMeta.setdocmeta!(UnfoldSim, :DocTestSetup, :(using UnfoldSim); recursive=true)
doctest(UnfoldSim)'
- name: Update UnfoldDocs
if: github.ref == 'refs/heads/main'
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.UNFOLDDOCSPAT }}
repository: unfoldtoolbox/UnfoldDocs
event-type: individual-docs-updated
40 changes: 36 additions & 4 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,52 @@
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: UnfoldSim.jl
message: 'If you use this page, please cite it as below.'
title: >-
UnfoldSim.jl: Simulating continuous event-based time
series data for EEG and beyond
message: "If you use this package, please cite it as below."
type: software
authors:
- given-names: Judith
family-names: Schepers
orcid: "https://orcid.org/0009-0000-9270-730X"
- given-names: Luis
family-names: Lips
- given-names: Maanik
family-names: Marathe
- given-names: Benedikt
family-names: Ehinger
orcid: 'https://orcid.org/0000-0002-6276-3332'
orcid: "https://orcid.org/0000-0002-6276-3332"
identifiers:
- type: doi
value: 10.5281/zenodo.7738651
repository-code: 'https://github.com/unfoldtoolbox/UnfoldSim.jl'
description: Zenodo
- type: doi
value: 10.21105/joss.06641
description: JOSS paper
repository-code: "https://github.com/unfoldtoolbox/UnfoldSim.jl"
preferred-citation:
authors:
- family-names: Schepers
given-names: Judith
orcid: "https://orcid.org/0009-0000-9270-730X"
- family-names: Lips
given-names: Luis
- family-names: Marathe
given-names: Maanik
- family-names: Ehinger
given-names: Benedikt V.
orcid: "https://orcid.org/0000-0002-6276-3332"
date-published: "2025-03-14"
doi: 10.21105/joss.06641
issn: 2475-9066
issue: 107
journal: Journal of Open Source Software
publisher:
name: Open Journals
start: 6641
title: "UnfoldSim.jl: Simulating continuous event-based time series
data for EEG and beyond"
type: article
url: "https://joss.theoj.org/papers/10.21105/joss.06641"
volume: 10
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "UnfoldSim"
uuid = "ed8ae6d2-84d3-44c6-ab46-0baf21700804"
authors = ["Benedikt Ehinger", "Luis Lips", "Judith Schepers", "Maanik Marathe"]
version = "0.4.0"
version = "0.4.1"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand All @@ -17,6 +17,7 @@ MixedModels = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316"
MixedModelsSim = "d5ae56c5-23ca-4a1f-b505-9fc4796fc1fe"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SequentialSamplingModels = "0e71a2a6-2b30-4447-8742-d083a85e82d1"
SignalAnalysis = "df1fea92-c066-49dd-8b36-eace3378ea47"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsModels = "3eaba693-59b7-5ba5-a881-562e759f1c8d"
Expand All @@ -35,6 +36,7 @@ MixedModels = "4"
MixedModelsSim = "0.2"
Parameters = "0.12"
Random = "1"
SequentialSamplingModels = "0.12"
SignalAnalysis = "0.4, 0.5,0.6,0.7,0.8,0.9,0.10"
Statistics = "1"
StatsModels = "0.6,0.7"
Expand Down
49 changes: 40 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# [![logo_UnfoldSim jl_120px](https://github.com/unfoldtoolbox/UnfoldSim.jl/assets/57703446/139a06c7-55c6-4c2e-8935-627a3c3bf036)](https://github.com/unfoldtoolbox/UnfoldSim.jl/tree/main)

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://unfoldtoolbox.github.io/UnfoldSim.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://unfoldtoolbox.github.io/UnfoldSim.jl/dev/)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://unfoldtoolbox.github.io/UnfoldDocs/UnfoldSim.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://unfoldtoolbox.github.io/UnfoldDocs/UnfoldSim.jl/dev/)
[![Build Status](https://github.com/unfoldtoolbox/UnfoldSim.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/unfoldtoolbox/UnfoldSim.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/v/UnfoldSim.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/unfoldtoolbox/UnfoldSim.jl)
[![DOI](https://zenodo.org/badge/413455526.svg)](https://zenodo.org/badge/latestdoi/413455526)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.06641/status.svg)](https://doi.org/10.21105/joss.06641)

|rERP|EEG visualisation|EEG Simulations|BIDS pipeline|Decode EEG data|Statistical testing|
|---|---|---|---|---|---|
| <a href="https://github.com/unfoldtoolbox/Unfold.jl/tree/main"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277623787-757575d0-aeb9-4d94-a5f8-832f13dcd2dd.png"></a> | <a href="https://github.com/unfoldtoolbox/UnfoldMakie.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277623793-37af35a0-c99c-4374-827b-40fc37de7c2b.png"></a>|<a href="https://github.com/unfoldtoolbox/UnfoldSim.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277623795-328a4ccd-8860-4b13-9fb6-64d3df9e2091.png"></a>|<a href="https://github.com/unfoldtoolbox/UnfoldBIDS.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277622460-2956ca20-9c48-4066-9e50-c5d25c50f0d1.png"></a>|<a href="https://github.com/unfoldtoolbox/UnfoldDecode.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277622487-802002c0-a1f2-4236-9123-562684d39dcf.png"></a>|<a href="https://github.com/unfoldtoolbox/UnfoldStats.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277623799-4c8f2b5a-ea84-4ee3-82f9-01ef05b4f4c6.png"></a>|
|Estimation|Visualisation|Simulation|BIDS pipeline|Decoding|Statistics|MixedModelling|
|---|---|---|---|---|---|---|
| <a href="https://github.com/unfoldtoolbox/Unfold.jl/tree/main"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277623787-757575d0-aeb9-4d94-a5f8-832f13dcd2dd.png" alt="Unfold.jl Logo"></a> | <a href="https://github.com/unfoldtoolbox/UnfoldMakie.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277623793-37af35a0-c99c-4374-827b-40fc37de7c2b.png" alt="UnfoldMakie.jl Logo"></a>|<a href="https://github.com/unfoldtoolbox/UnfoldSim.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277623795-328a4ccd-8860-4b13-9fb6-64d3df9e2091.png" alt="UnfoldSim.jl Logo"></a>|<a href="https://github.com/unfoldtoolbox/UnfoldBIDS.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277622460-2956ca20-9c48-4066-9e50-c5d25c50f0d1.png" alt="UnfoldBIDS.jl Logo"></a>|<a href="https://github.com/unfoldtoolbox/UnfoldDecode.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277622487-802002c0-a1f2-4236-9123-562684d39dcf.png" alt="UnfoldDecode.jl Logo"></a>|<a href="https://github.com/unfoldtoolbox/UnfoldStats.jl"><img src="https://github-production-user-asset-6210df.s3.amazonaws.com/10183650/277623799-4c8f2b5a-ea84-4ee3-82f9-01ef05b4f4c6.png" alt="UnfoldStats.jl Logo"></a>|<a href=""><img src="https://github.com/user-attachments/assets/ffb2bba6-3a30-48b7-9849-7d4e7195b297" alt="UnfoldMixedModels.jl logo"></a>|

A Julia package to simulate multivariate time series, e.g. model-based ERPs, fMRI activity, pupil dilation etc.
UnfoldSim.jl provides multi-channel support via EEG-forward models. Moreover, it is possible to simulate overlapping event-related activity and to add noise of a certain type e.g. Pink noise.

Many tutorials, guides, how-tos and references are available in the [documentation](https://unfoldtoolbox.github.io/UnfoldSim.jl/)!
Many tutorials, guides, how-tos and references are available in the [documentation](https://unfoldtoolbox.github.io/UnfoldDocs/UnfoldSim.jl/)!

![unfoldsim_animation](https://github.com/unfoldtoolbox/UnfoldSim.jl/blob/assets/docs/src/assets/UnfoldSim_features_animation.gif)

Expand Down Expand Up @@ -79,7 +80,7 @@ data, events = simulate(
EEG researchers often analyze data containing (temporally) overlapping events (e.g. stimulus onset and button press, or consecutive eye-fixations), non-linear effects, and complex experimental designs. For a multitude of reasons, we often need to simulate such kinds of data: Simulated EEG data is useful to test preprocessing and analysis tools, validate statistical methods, illustrate conceptual issues, test toolbox functionalities, and find limitations of traditional analysis workflows. For instance, such simulation tools allow for testing the assumptions of new analysis algorithms and testing their robustness against any violation of these assumptions.

<!--
Note: The statement of need is also used on the documentation landing page (https://unfoldtoolbox.github.io/UnfoldSim.jl/stable/). Make sure that they are synchronized.
Note: The statement of need is also used on the documentation landing page (https://unfoldtoolbox.github.io/UnfoldDocs/UnfoldSim.jl/stable/). Make sure that they are synchronized.
-->

## Contributions
Expand Down Expand Up @@ -115,8 +116,38 @@ Please reach out, if you have contributed to UnfoldSim.jl but we have not listed

## Citation

TBA
If you use UnfoldSim.jl, please acknowledge and support our work by citing

**1\. Our [JOSS paper](https://doi.org/10.21105/joss.06641):**

```
Schepers et al., (2025). UnfoldSim.jl: Simulating continuous event-based time series data for EEG and beyond.
Journal of Open Source Software, 10(107), 6641, https://doi.org/10.21105/joss.06641
```

<details>
<summary>BibTeX entry:</summary>

```bib
@article{Schepers2025,
doi = {10.21105/joss.06641},
url = {https://doi.org/10.21105/joss.06641},
year = {2025},
publisher = {The Open Journal},
volume = {10},
number = {107},
pages = {6641},
author = {Judith Schepers and Luis Lips and Maanik Marathe and Benedikt V. Ehinger},
title = {UnfoldSim.jl: Simulating continuous event-based time series data for EEG and beyond},
journal = {Journal of Open Source Software}
}
```
</details>

and

**2\. The corresponding [Zenodo DOI](https://doi.org/10.5281/zenodo.7738651)** for the specific UnfoldSim.jl version that you are using in your work.

## Acknowledgements

Funded by Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany´s Excellence Strategy – EXC 2075 – 390740016. Furthermore, the authors thank the International Max Planck Research School for Intelligent Systems (IMPRS-IS) for supporting Judith Schepers.
Funded by Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany's Excellence Strategy – EXC 2075 – 390740016. Furthermore, the authors thank the International Max Planck Research School for Intelligent Systems (IMPRS-IS) for supporting Judith Schepers.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SequentialSamplingModels = "0e71a2a6-2b30-4447-8742-d083a85e82d1"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
Expand Down
189 changes: 189 additions & 0 deletions docs/literate/tutorials/simulateDriftOverlap.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# # Simulate an Evidence Accumulation Overlap and Deconvolution

# We want to use the SequenceDesign with three components to simulate an full evidence accumulation process with a Overlap between the evidence accumulation and the response signal. Afterwards we use the Deconvolution Method from Unfold to unfold the signals again.



# ### Setup
# ```@raw html
# <details>
# <summary>Click to expand</summary>
# ```
using UnfoldSim
using Unfold
using StableRNGs
using CairoMakie, UnfoldMakie
using SequentialSamplingModels

fs = 500
Δt = 1 / fs; # time step
tEnd = 1.0 # trial Duration
time_vec = 0:Δt:tEnd; # time base - let's make it a typical stimulus duration
max_length = tEnd / Δt

c_stimulus = LinearModelComponent(;
basis = ones(Int(0.1 * fs)),
formula = @formula(0 ~ 1 + condition),
β = [1, 0],
)
c_response = LinearModelComponent(;
basis = ones(Int(0.2 * fs)),
formula = @formula(0 ~ 1 + condition),
β = [-0.5, 0],
)

# ```@raw html
# </details >
# ```
# ## Design
# Let's generate a single design with two drift_rates
design_single =
SingleSubjectDesign(conditions = Dict(:drift_rate => [1, 2], :condition => [1]))
design_seq = SequenceDesign(design_single, "SCR_")
design_rep = RepeatDesign(design_seq, 100) # 100 SCR-repeats

# # Simplified S-C-R drift-model with LBA
# ## LBA
# The following parameters are described in the [SequentialSamplingModels.LBA model documentation](https://itsdfish.github.io/SequentialSamplingModels.jl/dev/lba/)
v = [0.8] ## Drift Rate, needs to be in [ ] for compatability with `SequentialSamplingModels.jl``
A = 0.2 ## The starting point is sampled uniformly between `[0, A]`
k = 0.4 ## Difference of A with the bound/threshold ($A + k = b$), where b is the decision threshold.

lba_parameter = Dict(:ν => v, :A => A, :k => k, :τ => 0.0) # we didnt specify σ thus it is 1 by default,

# !!! important
# The non-decision time has to be specified here as "τ=>0." because it is not defined whether non-decision time applies to stimulus encoding or response execution. If you have a non-0 value here, the events following the DriftComponent will be shifted by τ.
drift = DriftComponent(max_length, fs, LBA, lba_parameter)

# Let's have a quick look at the simulation
series(
hcat(simulate_component.(StableRNG.(1:10), Ref(drift), Ref(design_single))...)',
solid_color = (:black, 0.5),
)
# Super! Our start values are sampled between [0, 0.2] as indicated, and the boundary is at A+k = 0.2 + 0.4 = 0.6

# ### Simulate EEG data
components = Dict('S' => [c_stimulus], 'C' => [drift], 'R' => [c_response])

# Next we define a SequenceOnset ingredient, this allows us fine-grained control on when events should happen.

seq_onset = SequenceOnset(
Dict(
'S' => UniformOnset(width = 0, offset = 0.2 * fs), # distance S<->C - we could choose 0.1*fs to immediately start after the stimulus component
'C' => DriftOnset(), ## automatically determines which is the respective DriftComponent
'R' => UniformOnset(width = 0, offset = 2 * fs), # distance R<->S
),
)

# ## Simulate data with the created design, components and onsets
data, evts = UnfoldSim.simulate(
StableRNG(12),
design_rep,
components,
seq_onset,
NoNoise(), # PinkNoise(noiselevel=1)
)
# ## Plot EEG to see the overlap as it appears
f_data, _ax, _h = lines(data[1:5000])
vlines!(evts.latency, color = Int.(evts.event), alpha = 0.3)
xlims!(700, 3500)
f_data

# # Complex S-C-R drift-model ala `Kelly et al.`

# In addition to changing the model to a more realistic version, we will also make use of the `drift_rate` specification in our `design``

v = "drift_rate" ## take the drift rate directly from the design

# The KellyModel has _many_ default parameters, let's grab them and immediately change a few

kelly_model =
UnfoldSim.KellyModel(drift_rate = v, motor_delay = 0.4, sensor_encoding_delay = 0.2)



% parameters:
% Urgency:
Z = 0.3; % starting level at evidence onset
U = 1; % slope (buildup rate) of dynamic urgency at the motor level (prop. to bound /sec)
Sz = 0.4; % start point variability at the motor level applied independently to both sides - full width of uniform distribution
Su = 0.17 % between-trial var in urgency rate

d = [1 2]; % drift rate
s = 0.5; % gaussian noise /sec at accumulator level
evonT = 0.2; % time at which sensory evidence starts impacting on the sensory accumulator
%accT = 0.2; % Accumulation onset time. Let's say same as evidence encoding onset.
mT = 0.1; % motor time
st = 0.1; % motor time variability
Terz = 0.1; % variability applied to sensory encoding delays

postAccDurM = 0.1; % mean duration of post decision accumulation
postAccDurS = 0.2; % range of uniform dist of post-decision accumulation duration

CPPrampdownDur = 0.1; % in Sec; CPP will linearly ramp back down after the accumulation stops


kelly_model = UnfoldSim.KellyModel(
drift_rate = v,
motor_delay = 0.1,
motor_delay_varibility = 0.1,
sensor_encoding_delay_variability = 0.1,
sensor_encoding_delay = 0.1,
accumulative_level_noise=0.5,
urgency = 1,
urgency_variability = 0.17,
post_accumulation_duration = 0.1,
post_accumulation_duration_variability = 0.2,
boundary = 0.7,
ramp_down_duration = 0.1
)
kelly_model_parameter = UnfoldSim.create_kelly_parameters_dict(kelly_model)
drift = DriftComponent(max_length, fs, UnfoldSim.KellyModel, kelly_model_parameter)
components = Dict('S' => [c_stimulus], 'C' => [drift], 'R' => [c_response])

# We are ready to simulate!
data, evts = UnfoldSim.simulate(
StableRNG(12),
design_rep,
components,
seq_onset,
NoNoise(), # PinkNoise(noiselevel=1)
)
# ## Plot EEG to see the overlap as it appears
f_data, _ax, _h = lines(data[1:5000])
vlines!(evts.latency, color = Int.(evts.event), alpha = 0.3)
xlims!(700, 3500)
f_data

# !!! note
# There are varying gaps between the stimulus offset <-> driftstart and driftend <-> response start. This is because the `KellyModel` by default has a `sensor_encoding_delay` and a `motor_delay` (including a `motor_delay_variability` etc.)

# # ERP & Deconvolution
# Let's calculate traditional ERPs and deconvolved ones!
evts.event = string.(evts.event) # due to a Unfold-bug we have to convert :S
data_epochs, times_epoch =
Unfold.epoch(data = data, tbl = evts, τ = (-1.3, 1.3), sfreq = fs);
f = @formula(0 ~ 1 + drift_rate)
m = fit(UnfoldModel, ["S" => (f, times_epoch), "R" => (f, times_epoch)], evts, data_epochs);
plot_erp(
effects(Dict(:drift_rate => [2, 3]), m);
mapping = (;
color = :drift_rate => nonnumeric,
col = :eventname => UnfoldMakie.sorter(["S", "R"]),
),
)

# ## Deconvolution of the overlap
fir_stim = firbasis(τ = (-0.1, 1.3), sfreq = fs)
fir_resp = firbasis(τ = (-1, 0.3), sfreq = fs)

m = fit(UnfoldModel, ["S" => (f, fir_stim), "R" => (f, fir_resp)], evts, data);
plot_erp(
effects(Dict(:drift_rate => [2, 3]), m);
mapping = (;
color = :drift_rate => nonnumeric,
col = :eventname => UnfoldMakie.sorter(["S", "R"]),
),
)
# Deconvolution sucessfully removed the stimulus and response overlaps from our estimates, but it kept the drift-diffusion aspect nearly untouched. It is important to stress the "nearly", because depending on the `delay` parameters, this can potentially lead to problematic situation where it is unclear whether the drift activity should be assigned to S or R. In most realistic situations we found to be safe.
# Further note that the drift-diffusion amplitude can be reduced because it is split up between `S` and `R` events.`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
# Further note that the drift-diffusion amplitude can be reduced because it is split up between `S` and `R` events.`
# Further note that the drift-diffusion amplitude can be reduced because it is split up between `S` and `R` events.`

2 changes: 2 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ makedocs(;
"Simulate event-related potentials (ERPs)" => "generated/tutorials/simulateERP.md",
"Power analysis" => "generated/tutorials/poweranalysis.md",
"Multi-subject simulation" => "generated/tutorials/multisubject.md",
"S-C-R & Evidence accumulation models" => "./generated/tutorials/simulateDriftOverlap.md",
],
"Reference" => [
"Overview of functionality" => "./generated/reference/overview.md",
Expand All @@ -57,6 +58,7 @@ makedocs(;
"Use existing experimental designs & onsets in the simulation" => "./generated/HowTo/predefinedData.md",
"Simulated marginal effects" => "./generated/HowTo/getGroundTruth.md",
"Sequence of events (e.g. SCR)" => "./generated/HowTo/sequence.md",
#"Simulate LBA evidence accumulation models" => "./generated/HowTo/driftComponent.md",
],
"Developer documentation" => "developer_docs.md",
"API / Docstrings" => "api.md",
Expand Down
Loading
Loading