Skip to content

Navigation Menu

Sign in
Sign up

Unfold design matrix for only one condition #131

akapaj started this conversation in General
Discussion options

Hi Benedikt,
We are using the unfolding toolbox to extract betas in a fully between-subject experimental design. We are interested in two types of events per subject (blinks and steps). The design matrix for unfolding consist of the following:
cfg = [];
cfg.timelimits = [-0.5, 2];
cfg.eventtypes = { 'blink', 'step' };
cfg.formula = {'y ~ 1', 'y ~ 1' };
We unfolded the data with the following lines:

EEG_uf = uf_designmat(EEG,cfg); % create design matrix
EEG_uf = uf_timeexpandDesignmat(EEG_uf,cfg); % time-expand design matrix

% threshold value
winrej= [];
winrej = uf_continuousArtifactDetect(EEG_uf,'amplitudeThreshold',80);
EEG_uf = uf_continuousArtifactExclude(EEG_uf,struct('winrej',winrej));

EEG_uf = uf_glmfit(EEG_uf,cfg);
ufresult = uf_condense(EEG_uf);

We expect two intercepts, one for each event. This is what we got but the plot for blinks seems to have spikes instead of a ERP wave, and the one for steps is flat (see attached image).

unfold_2

The plot seems to have taken values from the betas (65 channels625 time step2 events) in ufresult, which was a series of zeros with only four columns that had actual values.

We wanted to ask if the design matrix that we had was correct and what would have caused the betas to be spikes?

Thanks and have a good day!

You must be logged in to vote

Replies: 6 comments 3 replies

Comment options

Hey!
indeed this is very strange. Can you do:

  • plot a single channel manually (e.g. plot(ufresult.beta(65,:,:))
  • If this doesnt look "good", can you plot uf_plotDesignmatrix

I could think that this is a bug in plotting similar to #93 ; which is an upstream bug in ggram, which is not fixed.

Cheers, Bene

You must be logged in to vote
0 replies
Comment options

Thanks for the comment Bene.
Actually we tried your suggestions and we got the below image:
unfold_newplot

Also we ploted the designMatrix and it seems to look ok:
designmatrix_plot

We think its not a ploting issue. It looks like the unfolding gives mostly zero values (see attached).
beta_results

You must be logged in to vote
0 replies
Comment options

  1. did you plot the same channel, because that channel is negative, in the uf_plotParam it is positive.
  2. can you plot the designmatrix after timeexpansion: uf_plotDesignmat(EEG1,'timeexpand',1)
    3)can you plot a single channel of the continuous signal plot(EEG.data(65,:))?

What does the last plot show?

You must be logged in to vote
0 replies
Comment options

Hi Bene, again thanks a lot for you time :)

  1. It was a different channel that's why it was negative. This channel with the uf_plotParam is negative as well.

  2. The design matrix after timeexpansion plot is below"
    designmatrix_plot_timeexpand

  3. We also plotted channel 65 of the EEG continuous signal:
    eegdata_chan65

This plot shows a continuous signal. So we don't understand why after unfolding it doesn't look continuous anymore.
Looking forward to your comments.

Cheers,
Enru and Armand

You must be logged in to vote
1 reply
Comment options

Tricky!
1)Can you leave out the if amplitude cleaning thingy?
2) it is strange that the xdc plot doesn't show any values, there should be staircase like patterns. Could you look into the EEG.unfold.xdc matrix and check that there are lots of 1's in there?

Comment options

Hi Bene,

What do you mean by the amplitude cleaning thingy?
For the xdc matrix, we retrieved a 1000*1000 matrix because it exceeds the Matlab space, and it seems to be all zeros (image below)

xdc

Do you think the issue is with the design matrix or the data that we feed into the unfolding toolbox?
If you would like to take a look, we can send you the scripts and a dataset.

Thanks :)

You must be logged in to vote
1 reply
Comment options

I meant this bit

winrej= [];
winrej = uf_continuousArtifactDetect(EEG_uf,'amplitudeThreshold',80);
EEG_uf = uf_continuousArtifactExclude(EEG_uf,struct('winrej',winrej));

If you can send me an EEG including the unfold-struct, I can debug it easier :)

Comment options

Hi Bene,
So the good news is that the threshold amplitude was the cause. We run the unfold first without rejection and seems to work (figure below).

unfold_chan65_woRejection

But it looks a bit noisy so we tried again with various thresholds and up to 250 was removing a lot of data. Then, we tried a amplitude threshold of 1000 (arbitrary) and the data looks cleaner.

unfold_chan65_1000Threshold

Do you see a problem of using such high amplitude threshold or do you have any suggestions of which threshold to use? Would you still want me to send you a dataset?

Many thanks again for the great help.

Cheers,
Enru and Armand

You must be logged in to vote
1 reply
Comment options

what amplitude threshold to use is very study specific (also e.g. do you want to keep/remove blinks, what's your filter settings etc.). So I cannot give any advice except to think of what the artefacts are, that you want to remove by the thresholding procedure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /