canlab / MediationToolbox

Single-level and multi-level mediation analyses for any kind of data, with bootstrap-based significance testing. Neuroimaging-oriented functions allow for mediation effect parametric mapping (mapping of mediation effects across the brain) and multivariate mediation.
https://canlabweb.colorado.edu/wiki/doku.php/help/mediation/m3_mediation_fmri_toolbox
78 stars 28 forks source link

Issue of unequal length of variables in Mediation_brain #26

Open Apurva1292 opened 2 years ago

Apurva1292 commented 2 years ago

Hello everyone,

I am new to running mediation_brain and encountered an issue. While running mediation_brain, we intend to use brain images as the mediator with X independent variable and Y dependent outcome score. In the run at the stage of mediator search, it reads the brain images list provided as mediators and creates an array with the values of every voxel in it. In the mediation part, inputs get set up that matches the length of all three inputs X, Y, and M. At this point, the error occurs as the unequal length of the variables X, Y and M the following:


Mask: /media/diabpro/New Volume/pmnsFMRIanalysis/fMRI_data/wau_fMRI_mask.nii.gz Rank data: No

Reading data. Direct calls to spm_defauts are deprecated. Please use spm('Defaults',modality) or spm_get_defauStatistics.

===============================================

Slice 1 : 6444 voxels in-mask Testing 6444 valid columns of 6444 total in matrix - current: 1 The mediation output below (and in the figures) is shown for the first valid voxel in the brain. It is intended to give you an idea of what the variables and output look like so you can check 1 Error using mediation>setup_inputs (line 1223) X, Y, and M must be equal in length

Error in mediation (line 183) setup_inputs(X, Y, M, varargin);

Error in mediation_search (line 143) [paths, stat] = mediation(X, Y, M(:,region), varargin{:}, 'persistent', extra_args{:}, 'pvals_for_boot', pvals_for_boot, 'arorder', arorder);

Error in mediation_brain/process_slice (line 314) slice_results = mediation_search('M', X, Y, M(:,whvox), varargin{:});

Error in mediation_brain (line 276) process_slice();

Error in PMNS_HHLH_FMRI_mediation (line 32) med_stats =mediation_brain(xx{1}, yy{1}, M1, 'mask', mask, 'plots', 'verbose', 'boot');

Any suggestions on how we can resolve the issue or find out more about the details of the mediation would be much appreciated.

Thank you Apurva