Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem ploting scatterplot #27

Open
tzuling1203 opened this issue Aug 17, 2022 · 0 comments
Open

Problem ploting scatterplot #27

tzuling1203 opened this issue Aug 17, 2022 · 0 comments

Comments

@tzuling1203
Copy link

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.

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);`

and the output figure
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant