0todd0000 / spm1d

One-Dimensional Statistical Parametric Mapping in Python
GNU General Public License v3.0
61 stars 21 forks source link

Issue with SPM plot in Matlab #178

Closed greentable4 closed 2 years ago

greentable4 commented 3 years ago

Hi,

I am trying to use the SPM package in Matlab to perform a one-way ANOVA. Each variable is composed of one column with one row. For example:

6.8 7 6 6.4 6 4.5 4 etc.

This is the script I am using in Matlab:

F=spm1d.stats.anova1(variableA,variableB,variableC); Fi=F.inference(0.05) Fi.plot()

However, I get the following error:

Error in script_SPM (line 3) Fi.plot()

I have also tried to use the two scripts for the one-way ANOVA in the following documentation: https://spm1d.org/doc/Stats1D/anova.html#one-way-anova

However, I still can't plot. What could be the error?

Thank you.

0todd0000 commented 3 years ago

The function call for anova1 looks like this in MATLAB:

F  = spm1d.stats.anova1(y, A);

where:

If your three variables are named v1, v2 and v3, you should be able to solve the problem like this:

y = [v1; v2; v3];
A = [ 1 * ones( size(v1, 1) );    2 * ones( size(v2, 1) );     3 * ones( size(v3, 1) );  ]

F  = spm1d.stats.anova1(y, A);