3dLME - Incorrect level coding in variable

Hello -
I am running 3dLME to assess whether PCC functional connectivity changes across task (within-subject); correlates with a between-subject continuous variable of negative urgency (Negurg_mc); and whether there is interaction between the two. I wanted to use 3dMVM, but I have a mean framewise displacement measure for each task, which would be a within-person continuous variable, so I think that makes 3dLME the preferable choice (based on 3dMVM documentation). Anyway, I have the overall model running, but for some reason the gltCode contrasts with the variable “Task” are giving the error “Incorrect level coding in variable Task”. Here is my code (I have 108 subjects, but am only showing the first 10 here for brevity - but for each of 6 task runs). Any thoughts as to what I am doing wrong? (Also - I am showing all of my contrasts here - but even the simplest task contrast, gltcode 1, was not working.)
Thanks so much in advance for your help!
Best,
Dani

3dLME -prefix 3dLME_iFC_PCC_NegUrg_Task_200612 -jobs 24
-model "TaskNegurg_mc+FD+Gender+Age+IQ"
-qVars “Negurg_mc,FD,Age,IQ”
-ranEff ‘~1’
-SS_type 3
-resid 3dLME_iFC_PCC_NegUrg_Task_200612_residuals
-num_glt 9
-gltLabel 1 ‘rsFC’ -gltCode 1 'Task : 1
rest’
-gltLabel 2 ‘Negurg_mc’ -gltCode 2 'Negurg_mc : ’
-gltLabel 3 ‘Negurg_mc_rsFC’ -gltCode 3 ‘Negurg_mc : Task : 1rest’
-gltLabel 4 ‘efnback_vs_rest’ -gltCode 4 'Task : 1
efnback1 + 1efnback2 - 2rest’
-gltLabel 5 ‘dynface_vs_rest’ -gltCode 5 ‘Task : 1dynface - 1rest’
-gltLabel 6 ‘reward_vs_rest’ -gltCode 6 ‘Task : 1reward1 + 1reward2 - 2rest’
-gltLabel 7 ‘Negurg_mc-efnback_vs_rest’ -gltCode 7 'Negurg_mc : Task : 1
efnback1 + 1efnback2 - 2rest’
-gltLabel 8 ‘Negurg_mc-dynface_vs_rest’ -gltCode 8 ‘Negurg_mc : Task : 1dynface - 1rest’
-gltLabel 9 ‘Negurg_mc-reward_vs_rest’ -gltCode 9 ‘Negurg_mc : 1reward1 + 1reward2 - 2*rest’
-dataTable
Subj Task FD Negurg_mc Gender Age IQ InputFile
10170 dynface 0.1719341 -0.961838 0 19.67 107.52 /sub-10170/ses-1/dynface/seed/PCC/sub-10170_ses-1_dynface_connectivity_PCC_sm4.nii.gz
10181 dynface 0.1460089 1.538162 1 24.23 95.04 /sub-10181/ses-1/dynface/seed/PCC/sub-10181_ses-1_dynface_connectivity_PCC_sm4.nii.gz
10183 dynface 0.1261234 -0.545171 0 18.13 109.86 /sub-10183/ses-1/dynface/seed/PCC/sub-10183_ses-1_dynface_connectivity_PCC_sm4.nii.gz
10185 dynface 0.1781824 -0.295171 0 22.02 102.84 /sub-10185/ses-1/dynface/seed/PCC/sub-10185_ses-1_dynface_connectivity_PCC_sm4.nii.gz
10186 dynface 0.2317186 0.038162 0 21.93 112.98 /sub-10186/ses-1/dynface/seed/PCC/sub-10186_ses-1_dynface_connectivity_PCC_sm4.nii.gz
10187 dynface 0.2848334 -0.128504 0 24.53 112.2 /sub-10187/ses-1/dynface/seed/PCC/sub-10187_ses-1_dynface_connectivity_PCC_sm4.nii.gz
10190 dynface 0.1781185 0.788162 1 22.29 111.42 /sub-10190/ses-1/dynface/seed/PCC/sub-10190_ses-1_dynface_connectivity_PCC_sm4.nii.gz
10192 dynface 0.09225709 0.704829 1 19.07 112.98 /sub-10192/ses-1/dynface/seed/PCC/sub-10192_ses-1_dynface_connectivity_PCC_sm4.nii.gz \


10170 efnback1 0.1480631 -0.961838 0 19.67 107.52 /sub-10170/ses-1/efnback1/seed/PCC/sub-10170_ses-1_efnback1_connectivity_PCC_sm4.nii.gz
10181 efnback1 0.1208365 1.538162 1 24.23 95.04 /sub-10181/ses-1/efnback1/seed/PCC/sub-10181_ses-1_efnback1_connectivity_PCC_sm4.nii.gz
10183 efnback1 0.1109983 -0.545171 0 18.13 109.86 /sub-10183/ses-1/efnback1/seed/PCC/sub-10183_ses-1_efnback1_connectivity_PCC_sm4.nii.gz
10185 efnback1 0.1776716 -0.295171 0 22.02 102.84 /sub-10185/ses-1/efnback1/seed/PCC/sub-10185_ses-1_efnback1_connectivity_PCC_sm4.nii.gz
10186 efnback1 0.188915 0.038162 0 21.93 112.98 /sub-10186/ses-1/efnback1/seed/PCC/sub-10186_ses-1_efnback1_connectivity_PCC_sm4.nii.gz
10187 efnback1 0.1588672 -0.128504 0 24.53 112.2 /sub-10187/ses-1/efnback1/seed/PCC/sub-10187_ses-1_efnback1_connectivity_PCC_sm4.nii.gz
10190 efnback1 0.1601658 0.788162 1 22.29 111.42 /sub-10190/ses-1/efnback1/seed/PCC/sub-10190_ses-1_efnback1_connectivity_PCC_sm4.nii.gz
10192 efnback1 0.1155213 0.704829 1 19.07 112.98 /sub-10192/ses-1/efnback1/seed/PCC/sub-10192_ses-1_efnback1_connectivity_PCC_sm4.nii.gz \


10170 efnback2 0.1597939 -0.961838 0 19.67 107.52 /sub-10170/ses-1/efnback2/seed/PCC/sub-10170_ses-1_efnback2_connectivity_PCC_sm4.nii.gz
10181 efnback2 0.1313662 1.538162 1 24.23 95.04 /sub-10181/ses-1/efnback2/seed/PCC/sub-10181_ses-1_efnback2_connectivity_PCC_sm4.nii.gz
10183 efnback2 0.1591725 -0.545171 0 18.13 109.86 /sub-10183/ses-1/efnback2/seed/PCC/sub-10183_ses-1_efnback2_connectivity_PCC_sm4.nii.gz
10185 efnback2 0.165841 -0.295171 0 22.02 102.84 /sub-10185/ses-1/efnback2/seed/PCC/sub-10185_ses-1_efnback2_connectivity_PCC_sm4.nii.gz
10186 efnback2 0.2099927 0.038162 0 21.93 112.98 /sub-10186/ses-1/efnback2/seed/PCC/sub-10186_ses-1_efnback2_connectivity_PCC_sm4.nii.gz
10187 efnback2 0.2954463 -0.128504 0 24.53 112.2 /sub-10187/ses-1/efnback2/seed/PCC/sub-10187_ses-1_efnback2_connectivity_PCC_sm4.nii.gz
10190 efnback2 0.2049725 0.788162 1 22.29 111.42 /sub-10190/ses-1/efnback2/seed/PCC/sub-10190_ses-1_efnback2_connectivity_PCC_sm4.nii.gz
10192 efnback2 0.08825511 0.704829 1 19.07 112.98 /sub-10192/ses-1/efnback2/seed/PCC/sub-10192_ses-1_efnback2_connectivity_PCC_sm4.nii.gz \


10170 rest 0.1499741 -0.961838 0 19.67 107.52 /sub-10170/ses-1/rest/seed/PCC/sub-10170_ses-1_rest_connectivity_PCC_sm4.nii.gz
10181 rest 0.1320589 1.538162 1 24.23 95.04 /sub-10181/ses-1/rest/seed/PCC/sub-10181_ses-1_rest_connectivity_PCC_sm4.nii.gz
10183 rest 0.1530713 -0.545171 0 18.13 109.86 /sub-10183/ses-1/rest/seed/PCC/sub-10183_ses-1_rest_connectivity_PCC_sm4.nii.gz
10185 rest 0.1518534 -0.295171 0 22.02 102.84 /sub-10185/ses-1/rest/seed/PCC/sub-10185_ses-1_rest_connectivity_PCC_sm4.nii.gz
10186 rest 0.2191214 0.038162 0 21.93 112.98 /sub-10186/ses-1/rest/seed/PCC/sub-10186_ses-1_rest_connectivity_PCC_sm4.nii.gz
10187 rest 0.1705034 -0.128504 0 24.53 112.2 /sub-10187/ses-1/rest/seed/PCC/sub-10187_ses-1_rest_connectivity_PCC_sm4.nii.gz
10190 rest 0.1648329 0.788162 1 22.29 111.42 /sub-10190/ses-1/rest/seed/PCC/sub-10190_ses-1_rest_connectivity_PCC_sm4.nii.gz
10192 rest 0.08214958 0.704829 1 19.07 112.98 /sub-10192/ses-1/rest/seed/PCC/sub-10192_ses-1_rest_connectivity_PCC_sm4.nii.gz \


10170 reward1 0.1550091 -0.961838 0 19.67 107.52 /sub-10170/ses-1/reward1/seed/PCC/sub-10170_ses-1_reward1_connectivity_PCC_sm4.nii.gz
10181 reward1 0.1154455 1.538162 1 24.23 95.04 /sub-10181/ses-1/reward1/seed/PCC/sub-10181_ses-1_reward1_connectivity_PCC_sm4.nii.gz
10183 reward1 0.1430183 -0.545171 0 18.13 109.86 /sub-10183/ses-1/reward1/seed/PCC/sub-10183_ses-1_reward1_connectivity_PCC_sm4.nii.gz
10185 reward1 0.1726241 -0.295171 0 22.02 102.84 /sub-10185/ses-1/reward1/seed/PCC/sub-10185_ses-1_reward1_connectivity_PCC_sm4.nii.gz
10186 reward1 0.2414529 0.038162 0 21.93 112.98 /sub-10186/ses-1/reward1/seed/PCC/sub-10186_ses-1_reward1_connectivity_PCC_sm4.nii.gz
10187 reward1 0.3040328 -0.128504 0 24.53 112.2 /sub-10187/ses-1/reward1/seed/PCC/sub-10187_ses-1_reward1_connectivity_PCC_sm4.nii.gz
10190 reward1 0.1600325 0.788162 1 22.29 111.42 /sub-10190/ses-1/reward1/seed/PCC/sub-10190_ses-1_reward1_connectivity_PCC_sm4.nii.gz
10192 reward1 0.09959651 0.704829 1 19.07 112.98 /sub-10192/ses-1/reward1/seed/PCC/sub-10192_ses-1_reward1_connectivity_PCC_sm4.nii.gz \


10170 reward2 0.1763897 -0.961838 0 19.67 107.52 /sub-10170/ses-1/reward2/seed/PCC/sub-10170_ses-1_reward2_connectivity_PCC_sm4.nii.gz
10181 reward2 0.1152683 1.538162 1 24.23 95.04 /sub-10181/ses-1/reward2/seed/PCC/sub-10181_ses-1_reward2_connectivity_PCC_sm4.nii.gz
10183 reward2 0.1187985 -0.545171 0 18.13 109.86 /sub-10183/ses-1/reward2/seed/PCC/sub-10183_ses-1_reward2_connectivity_PCC_sm4.nii.gz
10185 reward2 0.1855945 -0.295171 0 22.02 102.84 /sub-10185/ses-1/reward2/seed/PCC/sub-10185_ses-1_reward2_connectivity_PCC_sm4.nii.gz
10186 reward2 0.2160566 0.038162 0 21.93 112.98 /sub-10186/ses-1/reward2/seed/PCC/sub-10186_ses-1_reward2_connectivity_PCC_sm4.nii.gz
10187 reward2 0.2618169 -0.128504 0 24.53 112.2 /sub-10187/ses-1/reward2/seed/PCC/sub-10187_ses-1_reward2_connectivity_PCC_sm4.nii.gz
10190 reward2 0.196132 0.788162 1 22.29 111.42 /sub-10190/ses-1/reward2/seed/PCC/sub-10190_ses-1_reward2_connectivity_PCC_sm4.nii.gz
10192 reward2 0.08254328 0.704829 1 19.07 112.98 /sub-10192/ses-1/reward2/seed/PCC/sub-10192_ses-1_reward2_connectivity_PCC_sm4.nii.gz \


Dani,

What OS are you running on? What is the R version? If it’s R version 4.0, there might have some thorny issue we need to sort out, and you may have to use version 3.6 to get around the issue.

We are running R version 3.5.1. I can try to upgrade to version 3.6 to see if that would help?

And I apologize - I realize I did not answer the rest of your question! I am running on Ubuntu 18.04.

Also, I did get the following message when I attempted to install the packages in R, as I am running this on a shared server (and R is installed in a read-only directory):

Installing package into ‘/software/R/3.5.1’
(as ‘lib’ is unspecified)
Warning in install.packages(“nlme”) :
‘lib = “/software/R/3.5.1”’ is not writable
Would you like to use a personal library instead? (yes/No/cancel) yes

So I have installed the packages to my personal library, but would this be causing some problem with reading the packages? Thanks!

I have installed the packages to my personal library, but would this be causing some problem with reading the packages?

It’s fine: the installed R package would only be accessible to you, but not to others who share the server. However, you need to first install R 3.6, and then you may have to re-install all the required R packages.

I have installed R 3.6.3 and re-installed all of the packages, and I unfortunately am still getting the same error messages.

I also thought that I would try the new version (3dLMEr) and there I am getting the error message that 3dLMEr: command not found (even though I installed this package, along with “phia” and “snow”), which makes me think that afni is not “seeing” my R library for some reason.

Do you have any further suggestions? Thanks!

Update: I was getting the same error message with 3dLME because a few syntax errors had sneaked in the gltcode. But now that those are corrected, the packages have seemingly loaded correctly, the program is still hung up at the point of:

If the program hangs here for more than, for example, half an hour,
kill the process because the model specification or the GLT coding
is likely inappropriate.

Possible reasons:

0) Make sure that R packages nlme and phia have been installed. See the 3dLME
help documentation for more details.

1) Inappropriate model specification with options -model, or -qVars.

2) In correct specifications in general linear test coding with -gltCode.

3) Mistakes in data table. Check the data structure shown above, and verify
whether there are any inconsistencies.

4) Inconsistent variable names which are case sensitive. For example, factor
named Group in model specification and then listed as group in the table hader
would cause grief for 3dLME.

** Error:
   Quitting due to model test failure...

Could you show the contingency table about Task and Gender? You can find it on the terminal when you run your 3dLME script.

The empty space after the positive (+) and negative sign (-) should be removed in your original script:

-gltLabel 4 ‘efnback_vs_rest’ -gltCode 4 ‘Task : 1efnback1 + 1efnback2 - 2rest’
-gltLabel 5 ‘dynface_vs_rest’ -gltCode 5 'Task : 1
dynface - 1rest’
-gltLabel 6 ‘reward_vs_rest’ -gltCode 6 'Task : 1
reward1 + 1reward2 - 2rest’
-gltLabel 7 ‘Negurg_mc-efnback_vs_rest’ -gltCode 7 ‘Negurg_mc : Task : 1efnback1 + 1efnback2 - 2rest’
-gltLabel 8 ‘Negurg_mc-dynface_vs_rest’ -gltCode 8 'Negurg_mc : Task : 1
dynface - 1rest’
-gltLabel 9 ‘Negurg_mc-reward_vs_rest’ -gltCode 9 'Negurg_mc : 1
reward1 + 1reward2 - 2rest’ \

Could you show the contingency table about Task and Gender? You can find it on the terminal when you run your 3dLME script.

I actually do not see this. The output includes:

++++++++++++++++++++++++++++++++++++++++++++++++++++
***** Summary information of data structure *****
107 subjects : 10170 10181 10183 10185 10186 10187 10190 10192 10193 10194 10196 10198 10200 10201 10202 10203 10205 10211 10213 10215 10216 10217 10219 10220 10221 10223 10224 10225 10226 10228 10230 10232 10234 10235 10237 10239 10240 10241 10242 10243 10244 10245 10246 10247 10249 10250 10251 10253 10254 10258 10260 10261 10262 10264 10267 10270 10271 10272 10274 10275 10276 10278 10279 10282 10283 10286 10287 10289 10290 10291 10292 10294 10295 10297 10298 10300 10301 10302 10303 10304 10306 10307 10310 10311 10312 10313 10314 10315 10316 10318 10319 10320 10321 10324 10326 10328 10329 10330 10335 10338 10339 10340 10341 10342 10343 10344 10345
642 response values
6 levels for factor Task : dynface efnback1 efnback2 rest reward1 reward2


9 post hoc tests

Contingency tables of subject distributions among the categorical variables:

Tabulation of subjects against all categorical variables

Subj vs Task:

        dynface efnback1 efnback2 rest reward1 reward2
  10170       1        1        1    1       1       1
  10181       1        1        1    1       1       1
  10183       1        1        1    1       1       1
  10185       1        1        1    1       1       1
  10186       1        1        1    1       1       1
***
So it seems that there is a space for contingency tables amongst variables, but that output is blank... unless I am not looking in the right place?


[i]The empty space after the positive (+) and negative sign (-) should be removed in your original script:[/i]

And right, this is the error that I previously noticed, and had already corrected to get the program to run to this point.

Just in case this is helpful to anyone else…
Thank you Gang! Your advice to switch the order of my continuous and categorical variable in the gltcode worked, so that categorical was first and continuous was second, like this. The program was crashing when the continuous variable (Negurg_mc) was first and categorical variable (Task) was second.

-num_glt 9
-gltLabel 1 ‘rsFC’ -gltCode 1 'Task : 1rest’
-gltLabel 2 ‘Negurg_mc’ -gltCode 2 'Negurg_mc : ’
-gltLabel 3 ‘Negurg_mc_rsFC’ -gltCode 3 'Task : 1
rest Negurg_mc : ’
-gltLabel 4 ‘efnback_vs_rest’ -gltCode 4 ‘Task : 0.5efnback1 +0.5efnback2 -1rest’
-gltLabel 5 ‘dynface_vs_rest’ -gltCode 5 'Task : 1
dynface -1rest’
-gltLabel 6 ‘reward_vs_rest’ -gltCode 6 'Task : 0.5
reward1 +0.5reward2 -1rest’
-gltLabel 7 ‘Negurg_mc-efnback_vs_rest’ -gltCode 7 'Task : 0.5efnback1 +0.5efnback2 -1rest Negurg_mc : ’
-gltLabel 8 ‘Negurg_mc-dynface_vs_rest’ -gltCode 8 'Task : 1
dynface -1rest Negurg_mc : ’
-gltLabel 9 ‘Negurg_mc-reward_vs_rest’ -gltCode 9 'Task : 0.5
reward1 +0.5reward2 -1rest Negurg_mc : ’ \