I am using an S-C-R SequenceDesign in some simulations, and using the EffectDesign I was trying to get the ground truth data. Here I noticed that the S component/ ERP seems shifted by several sample points. On further investigation this only happens when I provide all components ( S-C-R) to the simulate function (see below).
My guess is that simulate silently pads each component/ epoch when you want return_epoched=true to match the longest component, so that the data output doesn't lead to a mismatch. This is ofc, detrimental if you want to use the EffectsDesign output for an error analysis.
One current workaround would be to just make an EffectsDesign for each component independently (I think, haven't tried yet).
This might be related to #179 , but unsure
# Only the components and simulate function for later reference
p1 = LinearModelComponent(;
basis = p100(; sfreq = sfreq),
formula = @formula(0 ~ 1),
β = [s_amp],
)
n1 = LinearModelComponent(;
basis = n170(; sfreq = sfreq),
formula = @formula(0 ~ 1),
β = [s_amp],
)
p3 = LinearModelComponent(;
basis = UnfoldSim.hanning(0.2, 0.1, sfreq), # sfreq = 100 for the other bases
formula = @formula(0 ~ 1 + continuous),
β = [c_amp, 1],
)
resp = LinearModelComponent(;
#basis = UnfoldSim.hanning(Int(0.5 * sfreq)), # sfreq = 100 for the other bases
basis = UnfoldSim.hanning(0.2, 0.1, sfreq),
formula = @formula(0 ~ 1),
β = [r_amp],
offset = -10*2.5,
)
components = Dict('S' => [p1, n1], 'C' => [p3], 'R' => [resp])
gtd, gt_events = simulate(
MersenneTwister(1),
effects_design,
components['S'],
NoOnset(),
NoNoise(),
return_epoched = true,
);
# VS
gtd, gt_events = simulate(
MersenneTwister(1),
effects_design,
components, # <- the change
NoOnset(),
NoNoise(),
return_epoched = true,
);
I am using an S-C-R SequenceDesign in some simulations, and using the EffectDesign I was trying to get the ground truth data. Here I noticed that the S component/ ERP seems shifted by several sample points. On further investigation this only happens when I provide all components ( S-C-R) to the
simulatefunction (see below).My guess is that
simulatesilently pads each component/ epoch when you wantreturn_epoched=trueto match the longest component, so that thedataoutput doesn't lead to a mismatch. This is ofc, detrimental if you want to use the EffectsDesign output for an error analysis.One current workaround would be to just make an EffectsDesign for each component independently (I think, haven't tried yet).
This might be related to #179 , but unsure