0todd0000 / spm1d

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

regression analysis #162

Closed eleonora-mont closed 3 years ago

eleonora-mont commented 3 years ago

Hi Todd,

I want to establish the correlation between two variables to check whether they produce strong or weak correlation on a 2D pressure image. I am using matlab for this. Am I right to say that in the spm1d package, nonparametric regression is the test I have to adopt? If discrete analysis was conducted, I would use correlation stats but I am only aware of regression stats in spm1d.

Thanks, Eleonora

0todd0000 commented 3 years ago

Hi Eleonora,

Am I right to say that in the spm1d package, nonparametric regression is the test I have to adopt?

Yes.

If discrete analysis was conducted, I would use correlation stats but I am only aware of regression stats in spm1d.

spm1d.stats.regress implements simple linear regression, and correlation coefficients are included in the outputs. They can be retrieved using the parametric procedure like this:

spm = spm1d.stats.regress(Y, x)    # calculate test statistic (t values)
r   = spm.r    # correlation coefficients

Todd

eleonora-mont commented 3 years ago

Hi Todd,

Thanks for this, I tried it and it works fine. However, it brought up another question. I have been using only nonparametric statistics on my 2D pressure data so far. Is it right to say that regression will be still run with the nonparametric test but I am going to use the parametric test just to calculate the r values?

Thanks, Eleonora

0todd0000 commented 3 years ago

Sorry for the delay! The t and r values are identical for the parametric and nonparametric approaches; r values are simply not included in spm1d's nonparametric outputs.