Skip to content

Commit

Permalink
retroactive commit, alpha19
Browse files Browse the repository at this point in the history
  • Loading branch information
andersonwinkler committed Aug 30, 2014
1 parent d30b02e commit 2e99ebe
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
2 changes: 1 addition & 1 deletion palm_backend.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function palm_backend(varargin)

% Partition the model, now using the method chosen by the user
[plm.tmp.X,plm.tmp.Z,plm.tmp.eCm,plm.tmp.eCx] = ...
palm_partition(plm.M,plm.Cset{c},opts.pmethod);
palm_partition(plm.M,plm.Cset{c},opts.pmethod2);
plm.tmp.Mp = [plm.tmp.X plm.tmp.Z]; % partitioned design matrix, joined

% To avoid rank deficiency issues after partitioning, remove
Expand Down
3 changes: 2 additions & 1 deletion palm_defaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
opts.cmcx = false; % Use Conditional Monte Carlo (ignore repeated elements in X)?
opts.twotail = false; % Do a two-tailed t-test for the t-contrasts?
opts.fonly = false; % Run only the F-contrasts?
opts.pmethod = 'Beckmann'; % Method to partition the model.
opts.pmethod1 = 'Beckmann'; % Method to partition the model to define the permutation set
opts.pmethod2 = 'Beckmann'; % Method to partition the model for the actual regression
opts.rmethod = 'Freedman-Lane'; % Regression/permutation method.
opts.rfallback = 'terBraak'; % Regression/permutation method if correcting over contrasts
opts.NPC = false; % Do non-parametric combination?
Expand Down
7 changes: 6 additions & 1 deletion palm_partition.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
idx = any(C~=0,2);
X = M(:,idx);
Z = M(:,~idx);
eCm = C;
eCm = vertcat(C(idx,:),C(~idx,:));

case 'beckmann'
C2 = null(C');
Expand Down Expand Up @@ -76,6 +76,11 @@
eCm = vertcat(eye(size(X,2)),...
zeros(size(Z,2),size(X,2)));

case 'none'
X = M;
Z = [];
eCm = C;

otherwise
error('''%s'' - Unknown partitioning scheme',meth);
end
Expand Down
47 changes: 37 additions & 10 deletions palm_takeargs.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@

% Get the variance groups file.
opts.vg = vararginx{a+1};
opts.singlevg = false;
if ischar(opts.vg) && ...
~any(strcmpi(opts.vg,{'auto','automatic','default'})),
opts.singlevg = false;
opts.vg = 'auto';
end
a = a + 2;
Expand Down Expand Up @@ -734,24 +734,51 @@
opts.transposedata = true;
a = a + 1;

case '-pmethod', % not in the help
case '-pmethod1', % not in the help

% Which method to use for to partition the model?
% Which method to use to partition the model when defining
% the permutations?
if nargin > a,
methlist = { ...
'Guttman', ...
'Beckmann', ...
'Ridgway'};
'Winkler', ...
'Ridgway', ...
'none'};
methidx = strcmpi(vararginx{a+1},methlist);
if ~any(methidx);
error('Partition method "%s" unknown.',vararginx{a+1});
else
a = a + 2;
end
opts.pmethod = methlist{methidx};
opts.pmethod1 = methlist{methidx};
else
error([...
'The option -pmethod requires a method to be specified.\n'...
'The option -pmethod1 requires a method to be specified.\n'...
'Consult the documentation.']);
end

case '-pmethod2', % not in the help

% Which method to use to partition the model when defining
% doing the actual regression?
if nargin > a,
methlist = { ...
'Guttman', ...
'Beckmann', ...
'Winkler', ...
'Ridgway', ...
'none'};
methidx = strcmpi(vararginx{a+1},methlist);
if ~any(methidx);
error('Partition method "%s" unknown.',vararginx{a+1});
else
a = a + 2;
end
opts.pmethod2 = methlist{methidx};
else
error([...
'The option -pmethod2 requires a method to be specified.\n'...
'Consult the documentation.']);
end

Expand Down Expand Up @@ -930,12 +957,12 @@
' must be mean centered. Adding option ''-demean''.%s'],'');
opts.demean = true;
end
if opts.pearson && ~ any(strcmpi(opts.pmethod,{'beckmann','ridgway'})),
if opts.pearson && ~ any(strcmpi(opts.pmethod2,{'beckmann','ridgway'})),
warning([ ...
'To compute Pearson''s "r" or the "R^2", the design must be\n' ...
' partitioned using the Beckmann or Ridgway schemes.'...
' Adding the option ''-pmethod Beckmann''.%s'],'');
opts.pmethod = 'beckmann';
' Adding the option ''-pmethod2 Beckmann''.%s'],'');
opts.pmethod2 = 'beckmann';
end
if opts.demean && opts.vgdemean && ~ opts.pearson,
warning([...
Expand Down Expand Up @@ -1444,7 +1471,7 @@
plm.Xset = cell(plm.nC,1);
seqtmp = zeros(plm.N,plm.nC);
for c = 1:plm.nC,
plm.Xset{c} = palm_partition(plm.M,plm.Cset{c},'Beckmann');
plm.Xset{c} = palm_partition(plm.M,plm.Cset{c},opts.pmethod1);
[~,~,seqtmp(:,c)] = unique(plm.Xset{c},'rows');
end
if opts.corrcon && any(sum(diff(seqtmp,1,2).^2,2) ~= 0) ...
Expand Down

0 comments on commit 2e99ebe

Please sign in to comment.