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.
I tried the toolbox on my behavioral data and found it reported an error message while drawing scatterplots. I tried the sample data from the walkthrough and got the same results as below. It seemed that the "corr" function did not take more than 2 input arguments, which makes me quite confused. I used both MatLab 2019b and 2021a and had the same result. Could anyone help me out with this? Thank you very much.
This is my code copied from walkthrough.
X = rand(50, 1);
M = X + rand(50, 1);
Y = M + rand(50, 1);
[paths stats] = mediation(X, Y, M, 'plots');
This is the error message.
Error using [corr](matlab:matlab.internal.language.introspective.errorDocCallback('corr'))
Too many input arguments.
Error in [partialcorr](matlab:matlab.internal.language.introspective.errorDocCallback('partialcorr', 'C:\Program Files\MATLAB\R2019b\toolbox\stats\stats\partialcorr.m', 285)) ([line 285](matlab: opentoline('C:\Program Files\MATLAB\R2019b\toolbox\stats\stats\partialcorr.m',285,0)))
coef = corr(resid(:,1:dx),resid(:,dx+1:dx+dy),'type','pearson');
Error in [plot_correlation_samefig](matlab:matlab.internal.language.introspective.errorDocCallback('plot_correlation_samefig', 'E:\toolbox\CanlabCore-master\CanlabCore\Visualization_functions\plot_correlation_samefig.m', 168)) ([line 168](matlab: opentoline('E:\toolbox\CanlabCore-master\CanlabCore\Visualization_functions\plot_correlation_samefig.m',168,0)))
pr = partialcorr(y,X(:,1),X(:,2:end));
Error in [prplot](matlab:matlab.internal.language.introspective.errorDocCallback('prplot', 'E:\toolbox\CanlabCore-master\CanlabCore\Visualization_functions\prplot.m', 164)) ([line 164](matlab: opentoline('E:\toolbox\CanlabCore-master\CanlabCore\Visualization_functions\prplot.m',164,0)))
[r,str,sig,hh] = plot_correlation_samefig(rx,ry,[],mycols{1},0,dorobust);
Error in [mediation_scatterplots](matlab:matlab.internal.language.introspective.errorDocCallback('mediation_scatterplots', 'E:\toolbox\MediationToolbox-master\mediation_toolbox\mediation_scatterplots.m', 158)) ([line 158](matlab: opentoline('E:\toolbox\MediationToolbox-master\mediation_toolbox\mediation_scatterplots.m',158,0)))
prplot(M, [X [mediation](matlab:matlab.internal.language.introspective.errorDocCallback('mediation', 'E:\toolbox\MediationToolbox-master\mediation_toolbox\mediation.m', 642))_covariates], 1, dorobust, {'ko'});
Error in mediation ([line 642](matlab: opentoline('E:\toolbox\MediationToolbox-master\mediation_toolbox\mediation.m',642,0)))
mediation_scatterplots(stats);`
Hi everyone,
I tried the toolbox on my behavioral data and found it reported an error message while drawing scatterplots. I tried the sample data from the walkthrough and got the same results as below. It seemed that the "corr" function did not take more than 2 input arguments, which makes me quite confused. I used both MatLab 2019b and 2021a and had the same result. Could anyone help me out with this? Thank you very much.
This is my code copied from walkthrough.
This is the error message.
and the output figure![image](https://user-images.githubusercontent.com/88994195/185026109-fbd13ff1-c63a-48b0-93b0-f5939c82846c.png)