0todd0000 / spm1dmatlab

One-Dimensional Statistical Parametric Mapping in Matlab.
GNU General Public License v3.0
28 stars 13 forks source link

SPM1d Regression #162

Closed MarkKramer closed 2 years ago

MarkKramer commented 2 years ago

Dear Prof Pataky,

I am busy completing an SPM1d regression between continuous forceplate data and peak torque values. Does the SPM1d analysis actually provide the "correlation coefficient" in the outputs? I was thinking that perhaps it is under "spm.r" or perhaps something else? It would be great if I could somehow show that if there is a significant cluster, what the approximate correlation is within that cluster?

Thank you again for all your time and effort.

Kind regards,

Mark

0todd0000 commented 2 years ago

Hi Mark,

Yes, for simple linear regression (spm1d.stats.regress), you should be able to access the correlation coefficient through spm.r:

spm  = spm1d.stats.regress(y, x);
r    = spm.r


There is a relatively simple transform between the r- and t-statistics; you can also manually calculate the former from the latter like this:

r = sqrt( t.^2 / (n - 2 + t.^2)  );

where n is the sample size (n = size(y,1)) and t is the t-statistic (spm.z).

MarkKramer commented 2 years ago

Brilliant, thank you once again.

hjr1949 commented 6 months ago

Dear Prof Pataky: Why is the correlation coefficient obtained using "spm.r" in MATLAB exactly the same as the one obtained using the "correl" function in Excel? What are the differences between SPM statistical correlation analysis and traditional Pearson correlation analysis? Thank you your time

Huang

0todd0000 commented 6 months ago

This issue was closed so thank you Huang for opening a new issue (#203). I've replied there.