Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pvals in tort generated signal #20

Open
m-bellv opened this issue Feb 26, 2024 · 0 comments
Open

Pvals in tort generated signal #20

m-bellv opened this issue Feb 26, 2024 · 0 comments

Comments

@m-bellv
Copy link

m-bellv commented Feb 26, 2024

Hello,

I was interested in comparing how low vs high PAC coupling looks, and so was interested in the included function to generate signals. However, I noticed that even when assigning high values of coupling (chi =0.0), pvalues aren't detected as significant above the permutations, though this isn't true when generating the signal with wavelet.

For instance, using:

f_pha = 6 # frequency phase for the coupling
f_amp = 90 # frequency amplitude for the coupling
n_epochs = 1 # number of trials

sf = 1000. # sampling frequency
n_times = 10*sf # number of time points

data, time = pac_signals_wavelet(f_pha=f_pha, f_amp=f_amp, noise=0.8,
n_epochs=n_epochs, n_times=n_times, sf=sf, pp=0.0)
p = Pac(idpac=(2, 3, 0), f_pha=(2, 29, 1, .2), f_amp=(30, 120, 5, 1))
xpac = p.filterfit(sf, data2, n_perm=n_perm, n_jobs=4, random_state=0 ).squeeze()
xpac_smean = xpac[pval < .05].mean()
p.comodulogram(xpac, title='Modulation Index (MI)', cmap='viridis', vmin=0., pvalues=pval,
levels=.05)

I am able to produce the figure as given in https://etiennecmb.github.io/tensorpac/auto_examples/stats/plot_pvalues.html#sphx-glr-auto-examples-stats-plot-pvalues-py

fig1

However, when generating the signal using tort:
data, time = pac_signals_tort(f_pha=f_pha, f_amp=f_amp, sf=sf, n_times=n_times, n_epochs=n_epochs,
chi=0.0, noise=2.4, dpha=0.0, damp=0.0, rnd_state=0)
p = Pac(idpac=(2, 3, 0), f_pha=(2, 29, 1, .2), f_amp=(30, 120, 5, 1))
xpac = p.filterfit(sf, data, n_perm=n_perm, n_jobs=4,
random_state=0).squeeze()

pval = p.infer_pvalues(p=0.05)
xpac_smean = xpac[pval < .05].mean()
p.comodulogram(xpac, title='Modulation Index (MI) - wavelet', cmap='viridis', vmin=0., pvalues=pval,
levels=.05)

I get a similar region with high MI but it is no longer significant
fig2-1

And this is true with different noise levels, using dcomplex='hilbert' or 'wavelet', different methods of permutation calculation, different numbers of permutations, and different MI calculation methods (I have tried 2 for tort and 5 for gaussian copula). Is this an issue with the pac_signals_tort function, or an issue within the permutation generation?

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

No branches or pull requests

1 participant