Picturing wavelet shape

Jan Mathijs Schoffelen Jan.Schoffelen at FCDONDERS.RU.NL
Tue Oct 31 15:33:24 CET 2006


>Dear Jan
>
>Please can you advise me how to visualize the actual shape of the wavelets
>produced by the two parameters:
>
>width and gwidth
>
>I am getting some interesting/frustrating effects whereby  small changes in
>both values (varying width between 3-5, and gwidth between 1-4) and can
>flip the polarity  in my spectral plots. In other words, the location in
>time and frequency of significant power doesn't really change, but whether
>these are assigned an increase(red) or decrease
>(blue) in power does change relative to baseline. The spectrograms are
>created with singleplotTFR , combined with a baseline. I know I am at the
>resolution limits for these analyses, because of our relatively short time
>windows, but I am hoping that these effects can be explained by subtle
>changes in wavelet shape, and therefore I needn't worry too much.
>Alternatively, I may be pushing the analysis to breaking point, where it is
>too unreliable to report. But to help me decide, picturing the wavelet
>structure would be a real help (I think).

Dear Piers,

Hmmm, the easy answer to your question is to extract some of the relevant
lines to a new script and play around with that. When you look into the
code, in my version (revision version 1.16) the wavelets are constructed,
starting in line 214:

(for foilop = 1:numfoi)
  dt   = 1/data.fsample;
  sf   = cfg.foi(foilop)/cfg.width(foilop);
  st   = 1/(2*pi*sf);
  toi2 = -cfg.gwidth*st:dt:cfg.gwidth*st;
  A    = 1/sqrt(st*sqrt(pi));
  tap  = (A*exp(-toi2.^2/(2*st^2)))';
  ...
(end)

The vector tap contains the wavelet, which you can visualize with plot(tap);

So far the easy part. However, it is a bit obscure that you get opposite
effects by slightly adjusting your wavelet-parameters, and I suspect that
that is not a wavelet issue, but rather a baseline-issue.

If we look at your configuration for the plotting:

cfg5 = [];
cfg5.baseline     = [-0.2 0.0];
%cfg5.baselinetype = 'relative';
cfg5.baselinetype = 'absolute';
cfg5.zlim         = 'maxmin';
cfg5.xlim         = [-0.0 0.3];
cfg5.ylim         = [7 30];
cfg5.channel      = 'V0';
singleplotTFR(cfg5, freq);

You use a baseline-interval between -0.2 and 0. This essentially means, that
you are subtracting the estimated baseline, averaged between -0.2 and 0.
However, timepoint 0 contains quite some post-stimulus-onset stuff, because
of the width of your wavelet kernel (which scales with frequency, so I would
expect more of your strange effects in these ranges). If there's a strong
evoked component in your data, which bleeds into your baseline estimate,
this might lead to an overestimation of your baseline-power, and to a
subsequent stimulus-locked decrease in power post-stimulus. If there's less
bleeding into the baseline, the baseline estimate is lower, which would lead
to a stimulus-locked increase in power, which I would expect at a earlier
latency than the decrease described before.

Best

Jan-Mathijs




More information about the fieldtrip mailing list