<div dir="auto"><div>You can do it in a way you described, but a better way is to create one big dataset with all subjects, and run your analysis so that you will get average accuracy of your within subject classifications. Then you use attribute_permutator with the limit='subject' or something like that which will create permuted datasets where permutations are only performed within subjects. Then you just tepeat your analysis for each permutation to get the null distrinution of average within subject accuracied. You might also consider strategy='chunks' to deal with temporal dependencies.</div><div dir="auto"><br></div><div dir="auto">I am sorry i don't have an example code that would run this<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Tue, Apr 20, 2021, 19:43 Xiaobei Zhang <<a href="mailto:xiaobeiz@usc.edu">xiaobeiz@usc.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div>I am trying to do a group-level permutation test in pyMVPA. I have obtained individual p-values with permutation test and I think I should average the permuted distributions across subjects to get the p-value and mean accuracy. </div><div>I am not sure what I should do next and here are the current lines I have: </div><div>sub=[2003,2016,2077,2098,2989,1989......]<br>for subject in sub:<br></div><div>............ #basic parameters</div><div>clf = LinearCSVMC()<br>permutator = AttributePermutator('targets', count=1000)<br>distr_est = MCNullDist(permutator, tail='left', enable_ca=['dist_samples'])<br>cvte = CrossValidation(clf,splitter,errorfx=mean_mismatch_error,<br>                     postproc=mean_sample(),<br>                     null_dist=distr_est,enable_ca=['stats'])<br>    err=cvte(dataset)<br>    cvte.null_dist.append(cvte.null_dist)<br>    p = cvte.ca.null_prob<br>    assert(p.shape == (1,1))<br>    print 'Corresponding p-value:',  np.asscalar(p)<div></div><div><br></div></div><div>Thanks for your help!</div></div>
_______________________________________________<br>
Pkg-ExpPsy-PyMVPA mailing list<br>
<a href="mailto:Pkg-ExpPsy-PyMVPA@alioth-lists.debian.net" target="_blank" rel="noreferrer">Pkg-ExpPsy-PyMVPA@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa" rel="noreferrer noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa</a><br>
</blockquote></div></div></div>