trislett / TFCE_mediation

Fast regression and mediation analysis of vertex or voxel MRI data with TFCE
GNU General Public License v3.0
29 stars 9 forks source link

Vertex-wise Mediation Analyses -Error message #12

Open antoniettapepe opened 5 years ago

antoniettapepe commented 5 years ago

Hi,

I was trying to replicate step by step the work flow example for vertex wise mediation analyses on my own data, but while running the fourth step (mediation analysis), I run into this error message:

_Traceback (most recent call last): File "/homes_unix/pepe/anaconda2/envs/newer_plot_surfaces/bin/tfce_mediation", line 137, in args.func(args) File "/homes_unix/pepe/anaconda2/envs/newer_plot_surfaces/lib/python2.7/site-packages/tfce_mediation/tmanalysis/STEP_1_vertex_tfce_multiple_regression.py", line 245, in run y_lh = resid_covars(x_covars,data_lh) File "tfce_mediation/cynumstats.pyx", line 55, in tfce_mediation.cynumstats.resid_covars File "tfce_mediation/cynumstats.pyx", line 29, in tfce_mediation.cynumstats.cy_lin_lstsqr_mat File "/homes_unix/pepe/.local/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 528, in inv ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj) File "/homes_unix/pepe/.local/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 89, in _raise_linalgerrorsingular raise LinAlgError("Singular matrix") numpy.linalg.linalg.LinAlgError: Singular matrix

I am wondering if this has something to do with the way I defined my predictors or covariates (one column for variable, and one row for subject, no header, no subject IDs). In attempt to debug this problem, at line 236 of the STEP_1_vertex_tfce_multiple_regression.py, I printed the size of some variables:

_x_covars.shape = (452, 7) data_lh.shape = (149955, 452) n = 452 opts.input = ['predictor_lang_spat_memo_std_dm.csv', 'covariates_age_sex_hand_ne_std_dm.csv'] predx.shape=(452, 3) covars.shape= (452, 6)

Do them make any sense to you? I am also curious about the size 149955 in data_lh.shape, which does not seam to be equal to the number of vertices in the ?h.all.area.03B.mgh

Any ideas on this error message on this will be really appreciated

Antonietta

trislett commented 5 years ago

Hi Antonietta,

The "Singular matrix" error occurs when at least one of the regressor is the linear product of the other. Do you mind sharing your covariate and predictor files (email is fine)?

Regarding the shape of the data. 149955 vertices have non-zero values from the 164K surface (i.e., the same size of the Freesurfer ?h.cortex mask).

Cheers,

Tris