ttest(LIST)
--
You received this message because you are subscribed to the Google Groups "CoSMoMVPA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cosmomvpa+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/cosmomvpa/CAHe_OYHQf8tFXo%3DsCznrez1wOMTfWTYhX-NXhUx_3AzuphTTMw%40mail.gmail.com.
Dear Nick,Thank you so much for the quick response. I think I understand better now but would just like to double check with you: am I supposed to generate a new (group) data set from the individual (chance) accuracy maps
How do I input multiple nii files to cosmo_fmri_dataset?
for p=1:numSubj % for each participant
actual_dataset{p,1} = cosmo_fmri_dataset(fullfile(sprintf('%s',p,'xVal_no0.nii')); % get accuracy map
for r=1:100 % get all the null maps of this participant
null_datasets{p,r} = cosmo_fmri_dataset(fullfile(sprintf('%s',p),sprintf('xVal_no%d.nii',r))); % get r-th nul map
end
end
ds_group=cosmo_stack(actual_dataset,1); % combine to group dataset
ds_group.sa.chunks=ones(size(ds_group.samples,1),1).*(1:size(ds_group.samples,1))'; % list of subj numbers
ds_group.sa.targets=ones(size(ds_group.samples,1),1); % for t-test
nbrhood = cosmo_cluster_neighborhood(ds_group);
cosmo_montecarlo_cluster_stat(ds_group,nbrhood,'h0_mean',0,'null', null_datasets,'niter',10);
Error using cosmo_montecarlo_cluster_stat>check_null_datasets (line 746)
1-th null dataset: .samples size mismatch with dataset
nbrhood2 = cosmo_cluster_neighborhood(actual_dataset{:});
cosmo_montecarlo_cluster_stat(actual_dataset{:},nbrhood2,'h0_mean',0,'null', null_datasets,'niter',10);
Error using cosmo_check_neighborhood (line 69)
check_basis: field 'samples' not allowed in neighborhood
n_null=100;
n_subj=20;
null_cell=cell(n_null,1);
for i_null=1:n_null
subj_cell=cell(1,n_subj);
for i_subj=1:n_subj
fn=sprintf('s%02d_null%03d.nii',i_subj,i_null);
ds=cosmo_fmri_dataset(fn,'mask','common_group_mask.nii');
% (assume single volume)
ds.sa.targets=1;
ds.sa.chunks=i_subj;
subj_cell{i_subj}=ds;
end
null_cell{i_null} = cosmo_stack(subj_cell,1);
end
Dear Nick,
> For masking the group ds, I used ...
>>
>> [~,ds]=cosmo_mask_dim_intersect(ds);
>
>
> ... which worked well for the actual dataset but gives me an error for the null datasets:
>>
>> Error using cosmo_mask_dim_intersect (line 112)
>> Assertion failed.
Actually cosmo_mask_dim_intersect is supposed to work with cell inputs (where each element in the cell is a dataset struct), not with a dataset struct directly. Can you show the output of cosmo_disp(ds) assuming ds is the input that you provide in cosmo_mask_dim_intersect(ds) ?
I get{ .a
.vol .mat
[ -3 0 0 81 0 3 0 -115 0 0 3 -53
0 0 0 1 ]
.xform
'scanner_anat'
.dim
[ 53 63 46 ]
.fdim
.labels
{ 'i'
'j'
'k' }
.values
{ [ 1 2 3 ... 51 52 53 ]@1x53
[ 1 2 3 ... 61 62 63 ]@1x63
[ 1 2 3 ... 44 45 46 ]@1x46 }
.sa
struct (empty)
.samples
[ 0 0 0 ... 0 0 0 ]@1x153594
.fa
.i
[ 1 2 3 ... 51 52 53 ]@1x153594
.j
[ 1 1 1 ... 63 63 63 ]@1x153594
.k
[ 1 1 1 ... 46 46 46 ]@1x153594
etc., for each participant.I also checkediscell(ds)
ans =
logical
1
The second argument of cosmo_montecarlo_cluster_stat must be a neighbourhood, usually from cosmo_cluster_neighborhood. The null datasets must be provided using the 'null' option (or in a struct with a field named 'null').
I triednbrhood2 = cosmo_cluster_neighborhood(ds{:});ds_z = cosmo_montecarlo_cluster_stat(ds{:},nbrhood2,'h0_mean',0,'null', null_datasets,'niter',10);... which then gave me the error mentioned in the last email (field 'samples' not allowed in neighborhood).Very best,Nora
you should not use the ds{:} syntax, it expands the elements in the cell as arguments.
bla = struct('a',[],'sa',[],'samples',[],'fa',[]);
bla2 = repmat(bla,nsubj,1);
for i=1:nsubj
bla2(i)=ds{i};
end
nbrhood2 = cosmo_cluster_neighborhood(bla2);
Error using size
Too many input arguments.
size(bla2.samples)
bla2 =
27×1 struct array with fields:
a
sa
samples
fa
you should not use the ds{:} syntax, it expands the elements in the cell as arguments.Thanks for this explanation, I was not aware of this.Because cosmo_cluster_neighborhood seems to require a struct as input, I have now tried generating a struct from the ds, as follows:bla = struct('a',[],'sa',[],'samples',[],'fa',[]);
bla2 = repmat(bla,nsubj,1);
for i=1:nsubj
bla2(i)=ds{i};
endWhen using ...nbrhood2 = cosmo_cluster_neighborhood(bla2);... I now get the following error:Error using size
Too many input arguments.I get this error forsize(bla2.samples)bla2 =
27×1 struct array with fields:
a
sa
samples
faI guess I am creating this struct incorrectly?
actual_dataset = cell(n_subj,1);
for p=1:n_subj
actual_dataset{p,1} = cosmo_fmri_dataset(fullfile(pathAnalysis,sprintf('%dxVal_no0.nii',p));
actual_dataset{p,1}.sa.targets = 1;
actual_dataset{p,1}.sa.chunks = p;
end
[~,ds_group]=cosmo_mask_dim_intersect(actual_dataset);
ds_group = cosmo_stack(ds_group);
null_cell=cell(n_null,1);
for i_null=1:n_null
subj_cell=cell(1,n_subj);
for i_subj=1:n_subj
ds = cosmo_fmri_dataset(fullfile(pathAnalysis,sprintf('%dxVal_no%d.nii',p,i_null)));
ds.sa.targets=1;
ds.sa.chunks=p;
subj_cell{p}=ds;
end
null_cell{i_null} = cosmo_stack(subj_cell,1);
end
nbrhood2 = cosmo_cluster_neighborhood(ds_group);
ds_z = cosmo_montecarlo_cluster_stat(ds_group,nbrhood2,'h0_mean',0,'null', null_datasets,'niter',10);
Error using cosmo_check_external>check_matlab_toolbox (line 266)
The matlab toolbox 'stats' seems absent
cosmo_disp(null_datasets)
{ .samples
[ 0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
: : : : : :
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0 ]@27x153594
.sa
.chunks
[ 1
2
3
:
25
26
27 ]@27x1
.targets
[ 1
1
1
:
1
1
1 ]@27x1
.fa
.i
[ 1 2 3 ... 51 52 53 ]@1x153594
.j
[ 1 1 1 ... 63 63 63 ]@1x153594
.k
[ 1 1 1 ... 46 46 46 ]@1x153594
.a
.fdim
.labels
{ 'i'
'j'
'k' }
.values
{ [ 1 2 3 ... 51 52 53 ]@1x53
[ 1 2 3 ... 61 62 63 ]@1x63
[ 1 2 3 ... 44 45 46 ]@1x46 }
.vol
.mat
[ -3 0 0 81
0 3 0 -115
0 0 3 -53
0 0 0 1 ]
.xform
'scanner_anat'
.dim
[ 53 63 46 ]
.samples
[ 0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
: : : : : :
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0 ]@27x153594
.sa
.chunks
[ 1
2
3
:
25
26
27 ]@27x1
.targets
[ 1
1
1
:
1
1
1 ]@27x1
.fa
.i
[ 1 2 3 ... 51 52 53 ]@1x153594
.j
[ 1 1 1 ... 63 63 63 ]@1x153594
.k
[ 1 1 1 ... 46 46 46 ]@1x153594
.a
.fdim
.labels
{ 'i'
'j'
'k' }
.values
{ [ 1 2 3 ... 51 52 53 ]@1x53
[ 1 2 3 ... 61 62 63 ]@1x63
[ 1 2 3 ... 44 45 46 ]@1x46 }
.vol
.mat
[ -3 0 0 81
0 3 0 -115
0 0 3 -53
0 0 0 1 ]
.xform
'scanner_anat'
.dim
[ 53 63 46 ]
.samples
[ 0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
: : : : : :
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0 ]@27x153594
.sa
.chunks
[ 1
2
3
:
25
26
27 ]@27x1
.targets
[ 1
1
1
:
1
1
1 ]@27x1
.fa
.i
[ 1 2 3 ... 51 52 53 ]@1x153594
.j
[ 1 1 1 ... 63 63 63 ]@1x153594
.k
[ 1 1 1 ... 46 46 46 ]@1x153594
.a
.fdim
.labels
{ 'i'
'j'
'k' }
.values
{ [ 1 2 3 ... 51 52 53 ]@1x53
[ 1 2 3 ... 61 62 63 ]@1x63
[ 1 2 3 ... 44 45 46 ]@1x46 }
.vol
.mat
[ -3 0 0 81
0 3 0 -115
0 0 3 -53
0 0 0 1 ]
.xform
'scanner_anat'
.dim
[ 53 63 46 ]
:
.samples
[ 0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
: : : : : :
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0 ]@27x153594
.sa
.chunks
[ 1
2
3
:
25
26
27 ]@27x1
.targets
[ 1
1
1
:
1
1
1 ]@27x1
.fa
.i
[ 1 2 3 ... 51 52 53 ]@1x153594
.j
[ 1 1 1 ... 63 63 63 ]@1x153594
.k
[ 1 1 1 ... 46 46 46 ]@1x153594
.a
.fdim
.labels
{ 'i'
'j'
'k' }
.values
{ [ 1 2 3 ... 51 52 53 ]@1x53
[ 1 2 3 ... 61 62 63 ]@1x63
[ 1 2 3 ... 44 45 46 ]@1x46 }
.vol
.mat
[ -3 0 0 81
0 3 0 -115
0 0 3 -53
0 0 0 1 ]
.xform
'scanner_anat'
.dim
[ 53 63 46 ]
.samples
[ 0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
: : : : : :
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0 ]@27x153594
.sa
.chunks
[ 1
2
3
:
25
26
27 ]@27x1
.targets
[ 1
1
1
:
1
1
1 ]@27x1
.fa
.i
[ 1 2 3 ... 51 52 53 ]@1x153594
.j
[ 1 1 1 ... 63 63 63 ]@1x153594
.k
[ 1 1 1 ... 46 46 46 ]@1x153594
.a
.fdim
.labels
{ 'i'
'j'
'k' }
.values
{ [ 1 2 3 ... 51 52 53 ]@1x53
[ 1 2 3 ... 61 62 63 ]@1x63
[ 1 2 3 ... 44 45 46 ]@1x46 }
.vol
.mat
[ -3 0 0 81
0 3 0 -115
0 0 3 -53
0 0 0 1 ]
.xform
'scanner_anat'
.dim
[ 53 63 46 ]
.samples
[ 0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
: : : : : :
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0
0 0 0 ... 0 0 0 ]@27x153594
.sa
.chunks
[ 1
2
3
:
25
26
27 ]@27x1
.targets
[ 1
1
1
:
1
1
1 ]@27x1
.fa
.i
[ 1 2 3 ... 51 52 53 ]@1x153594
.j
[ 1 1 1 ... 63 63 63 ]@1x153594
.k
[ 1 1 1 ... 46 46 46 ]@1x153594
.a
.fdim
.labels
{ 'i'
'j'
'k' }
.values
{ [ 1 2 3 ... 51 52 53 ]@1x53
[ 1 2 3 ... 61 62 63 ]@1x63
[ 1 2 3 ... 44 45 46 ]@1x46 }
.vol
.mat
[ -3 0 0 81
0 3 0 -115
0 0 3 -53
0 0 0 1 ]
.xform
'scanner_anat'
.dim
[ 53 63 46 ]
--
You received this message because you are subscribed to the Google Groups "CoSMoMVPA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cosmomvpa+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/cosmomvpa/CAJXY1fJQztWARo1kYvjfFW%3D0tVSCLtFOF6%2BkRP5Dh%3Dk30-g%3DnA%40mail.gmail.com.
Hi Nick,
Brilliant, I'll give that a try.Thanks so much for all your help with this!!
n_null=100;
n_subj=30;
actual_dataset = cell(n_subj,1);
for p=1:n_subj
j=j+1;
actual_dataset{j,1} = cosmo_fmri_dataset('no0.mat'));
actual_dataset{j,1}.sa.targets = 1;
actual_dataset{j,1}.sa.chunks = j;
end
[~,ds_group]=cosmo_mask_dim_intersect(actual_dataset);
ds_group = cosmo_stack(ds_group,1,'drop_nonunique');
null_cell=cell(n_null,1);
for i_null=1:n_null
subj_cell=cell(1,27);
for i_subj=1:n_subj
rng('shuffle');
r = randi([1 100],1,1);
ds = cosmo_fmri_dataset(fullfile(sprintf('subj%s','no%.0f.mat',i_subj,r)));
ds.sa.targets=1;
ds.sa.chunks=i_subj;
subj_cell{1,i_subj}=ds;
end
[~,subj_cell2] = cosmo_mask_dim_intersect(subj_cell);
null_cell{i_null,1} = cosmo_stack(subj_cell2,1,'drop_nonunique');
end
[~,null_datasets]=cosmo_mask_dim_intersect(null_cell);
nbrhood2 = cosmo_cluster_neighborhood(ds_group);
ds_z = cosmo_montecarlo_cluster_stat(ds_group,nbrhood2,'h0_mean',0,'null', null_datasets,'niter',10000);
--
You received this message because you are subscribed to the Google Groups "CoSMoMVPA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cosmomvpa+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/cosmomvpa/CAJXY1fLWfpdBscbfGdB0jR4MudbwtHMSYh5%2Bji_Ey5eU6qxprA%40mail.gmail.com.
actual_dataset{j,1} = cosmo_fmri_dataset('no0.mat'));
To view this discussion on the web, visit https://groups.google.com/d/msgid/cosmomvpa/CAJXY1fKkRxGHeoYc8YhnN56heGoj%3Dv-%2BsSY3%2BEvqvx46SCEJVg%40mail.gmail.com.