Closed BeFaer closed 2 months ago
If the plot
method is missing it means that spm1d has interpreted the data as 0D and not as a set of 1D time series observations. You'll see this in the SPM object print-outs, for example:
SPM{T} (0D) inference
SPM.z : -12.57172
SPM.df : (1, 319)
Inference:
SPM.alpha : 0.050
SPM.zstar : 1.96743
SPM.h0reject : True
SPM.p : 0.00000
Notice the "0D
" in the header.
These data are 0D because they are 1D arrays (i.e., several observations of 0D values). In order to run 1D analysis you need 2D arrays (i.e., several observations of 1D values). The required array shapes are:
(J,)
for 0D analysis(J,Q)
for 1D analysiswhere:
J
= number of obervations Q
= number of 1D domain nodes (e.g. number of time nodes)Hi Todd,
thank you for your reply. If I understand correctly, this would mean not to use the overall grand mean data (calculated across all trials and participants for both systems individually over time), but rather to collect the individual trial data on the given joint DOF from both systems and feed this data into the SPM operation.
Is that the correct approach in order to get a 1D SPM object which has the plot method?
Thank you for your support.
Best
Bernhard
I am unsure whether using or not using the grand mean is relevant because it is a bit unclear what it is and how it is used. If the grand mean is a scalar or a 1D trajectory then its use should not matter. Regardless, if you submit 2D arrays to spm1d's univariate procedures (like t tests) then the data will be interpreted as 1D and 1D analysis will be conducted. I suggest simplifying the code you attached to conduct just a single test (on hip_flexion_r
, for example). If you can create 2D arrays for this test and thereby conduct 1D analysis then it should become straightforward how to analyze other cases.
Hello everyone,
I am currently trying to conduct a paired samples t-test on a set of data containing information on the movement of several joints over time. My goal is to compare two different motion capture systems and identify time periods, where these show statistically significant differences.
The data I am trying to run the SPM operations on contains the "overall grand mean" of all motion capture data for the given joint degree of freedom, averaged across all participants and their respective trials. I have time-normalized the data, however not to 101 samples as is shown in several explanatory YouTube videos and the example datasets as that lead to great alterations in the waveforms of both systems. Currently I am working with 320 data entries per movement for both systems I used.
My code currently looks like this:
I first create the needed datastructure for SMP1D (horizontally laid out numpy array) and a list to associate the unnamed rows to the previous column headers from my pd dataframes (this increases readability for me as I am not too experienced in Python).
I then want to loop across my specified rows of interest. I first check for normality and then perform either a parametric or non-parametric paired ttest.
So far for my intentions with this code, if I need to elaborate on certain aspects more please let me know and I'll do my best to clarify.
When running this code this is the console output:
When inspecting the spm_results dictionary, the accessible data looks much different than that from the examples provided (please see attached screenshot).
My main concern is that the .plot entry is missing which is why I cannot visualize my results.
Is there an issue in my code which leads to this and if so: What can I do to correct it? Are there other concerns to my approach?
As you can probably tell, I am fairly new to posting such questions on GitHub. I hope my issue is not beyond the scope of this forum.
Thank you in advance for any support and have a happy new year.