0todd0000 / spm1d

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

2D Data using SPM #124

Closed maipatrick closed 4 years ago

maipatrick commented 4 years ago

Hello,

thank you for providing such a detailed explanation for most of the functions. I would like to apply SPM1D to my experimental 2D data. Unfortunately, I failed to apply the provided 2D example to my data. Find attached an example file of 3 data matrices containing data for a specific location (similar to plantar foot pressure data). I would be great to get some advice about how to adapt the example script to my data. In short the matrices containing values from material testes of specific footwear. Thank you in advance. Example_File.zip

0todd0000 commented 4 years ago

Hello, thank you for this question.

We are unfortunately unable to check data files in this forum because readers will not be able to understand the problem unless the problem is described in the question itself.

Please describe the data and the problems you have encountered:

maipatrick commented 4 years ago

Hello 0todd0000, sorry for the delayed response. My Question belonged to the Matlab 2D example

I have five data arrays. Each of them is equal in size (66x211). Similar to the data you provided for the 2D example of foot pressure data. However, my matrices do not correspond to frames, instead, they belong to specific material tests at a specific location. I would like to use the 2D SPM1D approach to statistical test if the arrays are different and if so at which location they may differ.

In a very first step, I would like to test if two matrices are different using the ttest2. I have reshaped the matrices according to the example, resulting in a 2x13926 array.

When executing the function snpmi = snpm.inference(0.05, 'two_tailed', true, 'iterations', noIteration); I recieve the following error:

Error using spm1d.stats.nonparam.permuters.APermuter/check_iterations

Number of specified iterations (10) exceeds the maximum possible number of iterations (1)

Error in spm1d.stats.nonparam.snpm.SnPM0D_T/inference (line 24) self.permuter.check_iterations(alpha, iterations, force_iterations) Error in SPM2D_analysis snpmi = snpm.inference(0.05, 'two_tailed', true, 'iterations', noIteration);

I receive this error regardless of the input for the numbers iterations ( also if using 1 as suggested in the error).

It might be that I violate an assumption because of actually comparing only two arrays (one array for each "condition") instead of n arrays for each condition as provided in the example. This results in logical vectors of zeros when removing zero-variance nodes.

I hope the data and the problem is no described sufficient. I'm looking forward to a solution. (in case there is one :) )
Thank you very much in advance for your help.

0todd0000 commented 4 years ago

You are correct: the problem is that there is only one observation per group. It is not possible to statistically compare one observation to another because there is no variance. The only calculation that can be made is difference (or some function of the difference, like difference squared).

maipatrick commented 4 years ago

Thank you very much for your quick response. I'm wondering if it is possible to artificial increase my number of observations without changing the actual information content of my data. Imagine measuring the properties of a surface with different materials. The surface might be a rectangle and I determine row-wise the material properties with a 2cm grid. Meaning measuring one location go 2cm to the left measure another location. Subsequently, after the row is measured ( n measurements) the next column is measured. This is repeated m- times, resulting in a nxm measuring matrix. If I would do the same procedure for another rectangular surface with different material properties, I will end up with one observation for each "condition" (two surfaces).

To "artificial increase" the observation I would append the resulting matrix, for example, row-wise, meaning the first observation contains only information of the first row, the second observation of the first and second row and so on. (ensure data the matrixes the same size by filling the rest with zeros). When doing so I'm ending up with n observations without actually losing or adding information to my data. The same can be done for the second observation (eg the second triangular surface). See attached my SPM results I hope this makes sense and I'm not violating something and I have not totally confused you. :) Take care and Thank you in advance.

0todd0000 commented 4 years ago

That is fine for trial purposes, to get everything working, but it is not statistically valid to generate observations in this manner; the observations must be independently measured. To generate more observations, you would need to repeat the row-by-row measurements on additional, independent surfaces.

With the data you have at the moment, it is only valid to calculate the differences at each point, and then to display the difference image. This would only represent the difference between the two measurements. Statistical results (if you had more measurements) would represent the difference between the two populations of material samples.