0todd0000 / spm1d

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

Question rather than issue #83

Closed physioliz closed 5 years ago

physioliz commented 6 years ago

Hi I'm new to Python or in fact any kind of coding but trying to use SPM1d for biomechanical analysis. I'm coming up against a problem when I try to run a 2 sample t-test. Using the code from the website: t = spm1d.stats.ttest2(Y0, Y1, equal_var=False) ti = t.inference(alpha=0.05, two_tailed=False, interp=True) ti.plot()

Where Y is 101 data points for controls and Y0 is my subject I want to compare against. I keep getting the message inference() got an unexpected keyword argument 'interp'

Any ideas what I am doing wrong?

0todd0000 commented 6 years ago

It sounds like you might be using a previous version of spm1d. In previous versions there was no "interp" keyword argument to the "inference" function, so changing the second command as follows might solve the problem:

ti = t.inference(alpha=0.05, two_tailed=False)

If that also generates an error please let me know.

For a longer-term solution please update to the most recent version of spm1d. You can check the version using:

import spm1d
print( spm1d.__version__ )

The most recent version is:

0.4.1 (2016/12/09)

Last, please check that both Y0 and Y1 are (J x 101) arrays, where J is the number of 1D observations, and where J is greater than one, and preferably at least five.

physioliz commented 6 years ago

Hi Todd

Thanks for your reply. I have downloaded the latest version of spm1d now but the error still exists. I think it is due to my confusion about the data to input. When you say the number of 1D observations should be at least 5 do you mean for example knee angle in x, y, z … or up to 5 reps in the same person?

Sorry for the confusion.

Best wishes

Liz

From: Todd Pataky [mailto:notifications@github.com] Sent: 21 March 2018 01:52 To: 0todd0000/spm1d spm1d@noreply.github.com Cc: Elizabeth Chandler (HSC - Staff) E.Chandler@uea.ac.uk; Author author@noreply.github.com Subject: Re: [0todd0000/spm1d] Question rather than issue (#83)

It sounds like you might be using a previous version of spm1d. In previous versions there was no "interp" keyword argument to the "inference" function, so changing the second command as follows might solve the problem:

ti = t.inference(alpha=0.05, two_tailed=False)

If that also generates an error please let me know.

For a longer-term solution please update to the most recent version of spm1d. You can check the version using:

import spm1d

print( spm1d.version )

The most recent version is:

0.4.1 (2016/12/09)

Last, please check that both Y0 and Y1 are (J x 101) arrays, where J is the number of 1D observations, and where J is greater than one, and preferably at least five.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/0todd0000/spm1d/issues/83#issuecomment-374813913, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Aj1qBBodZRYvPfsnEZU_ioNr6eBjYUW7ks5tgbI8gaJpZM4Sxre1.

0todd0000 commented 6 years ago

Hi Liz,

That's odd that the error exists in the newest version. We might need to do some debugging to figure out what the problem is... Are you able to run the example scripts without errors? For example: ./spm1d/examples/stats1d/ex_ttest2.py

Regarding the number of observations... In the following command:

t = spm1d.stats.ttest2(Y0, Y1, equal_var=False)

there are two inputs: Y0 and Y1. Both of these variables must be (J x Q) arrays, where J is the sample size (i.e. the number of observations), and where Q is the number of continuum nodes (often 100 or 101). J must be greater than one, and should generally be five or larger when conducting hypothesis tests.

You can check the values of J and Q using:

print( Y0.shape )
print( Y1.shape )

That will produce output something like this:

(8, 101)
(8, 101)

which indicates that J=8 and Q=101.

Todd