0todd0000 / spm1d

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

How can I make 2d npy file from two 1d arrat npy files for Hotelling's T2 test? #217

Closed fastcloud-cho closed 2 years ago

fastcloud-cho commented 2 years ago

I prepared three 1d npy files (8 observations, 100 time nodes) for TA,PL, and Soleus EMG. I used np.dstack() command to converge those three files into a single 2d npy file, EMG1=np.dstack((TA1,PL1,SOL1)) which I attach as an URL below. (EMG1_TAPLSOL.npy)
https://drive.google.com/file/d/1oeUCa71lcUbgZvba6-xIyWBeqC3uMnoT/view?usp=sharing And made another 2d npy file, EMG2_TAPLSOL.npy.

But, when I tried Hotelling's T2 test on Jupyter Notebook, T2 = spm1d.stats.hotellings_paired(EMG1, EMG2) it returned me an error message; LinAlgError: Singular matrix

I think I made wrong 2d npy files.. Could you help me to make proper ones? (FYI, it's been about 10 days since I started practicing spm1d and Python following the online workshop)

0todd0000 commented 2 years ago

You will receive a singular matrix error if the data in EMG1 and EMG2 are identical.

Try using the same variable EMG1 twice; you should see the same singular matrix error when the variables are identical like this:

T2 = spm1d.stats.hotellings_paired(EMG1, EMG1)

To check whether EMG1 and EMG2 are indeed identical, use:

print(   np.all(EMG1==EMG2)   )

Please note: partly for security reasons we cannot analyze attached or linked data in this forum.

fastcloud-cho commented 2 years ago

Thank you so much!

스크린샷 2022-05-09 오후 5 34 41

Now, I will try to fix the problem.