3dMVM Error with loading dataframe

AFNI version info (Precompiled binary linux_centos_7_64: March 24 2021 (Version AFNI_21.0.21 'Titus'):

Hello,

When running 3dMVM, I am encountering the following error:

Error in `$<-.data.frame`(`*tmp*`, Subj, value = integer(0)) :
  replacement has 0 rows, data has 171
Calls: $<- -> $<-.data.frame
Execution halted

My initial suspicion was that the formatting of my data table was incorrect, but it appears to be find. Additionally, all of the necessary R packages appear to be installed when I run rPkgsInstall -pkgs ALL -check

Here is my call to 3dMVM:

3dMVM -prefix age_valence_da -jobs 4 \
      -bsVars 'group' \
      -wsVars 'valence' \
      -qVars 'da_group_norm' \
      -SS_type 3 \
      -num_glt 13 \
      -gltLabel 1 OA_vs_YA -gltCode 1 'group: 1*OA -1*YA' \
      -gltLabel 2 Rew_vs_Loss -gltCode 2 'valence: 1*reward -1*loss' \
      -gltLabel 3 Rew_vs_Neu -gltCode 3 'valence: 1*reward -1*neutral' \
      -gltLabel 4 Loss_vs_Neu -gltCode 4 'valence: 1*loss -1*neutral' \
      -gltLabel 5 OA_Rew_vs_Loss -gltCode 5 'group: 1*OA valence: 1*reward -1*loss' \
      -gltLabel 6 YA_Rew_vs_Loss -gltCode 6 'group: 1*YA valence: 1*reward -1*loss' \
      -gltLabel 7 age_by_valence_interaction -gltCode 7 'group: 1*OA -1*YA valence: 1*reward -1*loss' \
      -gltLabel 8 OA_da_by_valence_interaction -gltCode 8 'group: 1*OA valence: 1*reward -1*loss da_group_norm:' \
      -gltLabel 9 YA_da_by_valence_interaction -gltCode 9 'group: 1*YA valence: 1*reward -1*loss da_group_norm:' \
      -gltLabel 10 age_da_valence_3way_interaction -gltCode 10 'group: 1*OA -1*YA valence: 1*reward -1*loss & 1*reward -1*neutral da_group_norm:' \
      -gltLabel 11 age_at_highDA -gltCode 11 'group: 1*OA -1*YA da_group_norm: 3' \
      -gltLabel 12 age_at_midDA -gltCode 12 'group: 1*OA -1*YA da_group_norm: 0' \
      -gltLabel 13 age_at_lowDA -gltCode 13 'group: 1*OA -1*YA da_group_norm: -3' \
      -dataTable @age_valence_da.tsv

Thanks!
-Tom

Hi Tom,

You're running a pretty old version of AFNI there. Can you update to the newest binaries?

@update.afni.binaries -d

Unfortunately, I'm running this in a linux cluster environment without root access. Any way to debug this without updating binaries? (Or suggestions on how to install a version of afni without root access?)

Update without root: You can install AFNI in a directory that you own and then put it earlier in the path than the system owned version. We usually suggest ~/abin as a good place to put it. Since the system itself has all of the dependencies you should be fine just grabbing the newest binaries.

Hesitant to debug too much on such an old version since I know Gang has fixed a few things between 2021 and now.

1 Like

I have updated the binaries and my new afni version is: "Precompiled binary linux_centos_7_64: Aug 22 2023 (Version AFNI_23.2.08 'Marcus Didius Severus Julianus')

Unfortunately, I am still getting the same error when I try to run my 3dMVM command. Here is the full output of the command:

acai[0]:group_analysis$ tcsh 3dMVM_age_valence_da 
Read 3096 items
Loading required package: lme4
Loading required package: Matrix
Registered S3 methods overwritten by 'car':
  method                          from
  influence.merMod                lme4
  cooks.distance.influence.merMod lme4
  dfbeta.influence.merMod         lme4
  dfbetas.influence.merMod        lme4
************
Welcome to afex. For support visit: http://afex.singmann.science/
- Functions for ANOVAs: aov_car(), aov_ez(), and aov_4()
- Methods for calculating p-values with mixed(): 'S', 'KR', 'LRT', and 'PB'
- 'afex_aov' and 'mixed' objects can be passed to emmeans() for follow-up tests
- Get and set global package options with: afex_options()
- Set sum-to-zero contrasts globally: set_sum_contrasts()
- For example analyses see: browseVignettes("afex")
************

Attaching package: ‘afex’

The following object is masked from ‘package:lme4’:

    lmer

Loading required package: car
Loading required package: carData
Error in `$<-.data.frame`(`*tmp*`, Subj, value = integer(0)) : 
  replacement has 0 rows, data has 171
Calls: $<- -> $<-.data.frame
Execution halted

Can you paste the first 10 or so rows of your dataTable?

Sure thing!

subject	sex	age	group	group_binary_0OA_1YA	bilat_VST_FMT	dprime_all_valid	dprime_all_reward_valid	dprime_all_neutral	dprime_all_loss_valid	dprime_highconfidence_valid	dprime_highconfidence_reward_valid	dprime_highconfidence_neutral	dprime_highconfidence_loss_valid	excluded	valence	da_group_norm	InputFile
B07227	M	84	OA	0	0.029596906	0.398370148	0.398370148	0.398370148	0.398370148	-0.646973985	0.0	0.383771164	-0.328611323	0	reward	3.0529953490107333	../../group_analysis/rememberedreward_faceperiod/B07227.nii
B07227	M	84	OA	0	0.029596906	0.398370148	0.398370148	0.398370148	0.398370148	-0.646973985	0.0	0.383771164	-0.328611323	0	neutral	3.0529953490107333	../../group_analysis/rememberedneutral_faceperiod/B07227.nii
B07227	M	84	OA	0	0.029596906	0.398370148	0.398370148	0.398370148	0.398370148	-0.646973985	0.0	0.383771164	-0.328611323	0	loss	3.0529953490107333	../../group_analysis/rememberedloss_faceperiod/B07227.nii
B07237	F	83	OA	0	0.021246284	2.057483877	2.208610295	2.537221618	1.561636309	1.28478436	1.3489795	1.3489795	1.163266161	0	reward	0.16297431668123158	../../group_analysis/rememberedreward_faceperiod/B07237.nii
B07237	F	83	OA	0	0.021246284	2.057483877	2.208610295	2.537221618	1.561636309	1.28478436	1.3489795	1.3489795	1.163266161	0	neutral	0.16297431668123158	../../group_analysis/rememberedneutral_faceperiod/B07237.nii
B07237	F	83	OA	0	0.021246284	2.057483877	2.208610295	2.537221618	1.561636309	1.28478436	1.3489795	1.3489795	1.163266161	0	loss	0.16297431668123158	../../group_analysis/rememberedloss_faceperiod/B07237.nii
B07277	F	84	OA	0	0.017114777	0.939920986	0.831710016	0.831710016	1.15034938	0.77625397	1.544092503	1.373955456	1.544092503	0	reward	-1.266876313034323	../../group_analysis/rememberedreward_faceperiod/B07277.nii
B07277	F	84	OA	0	0.017114777	0.939920986	0.831710016	0.831710016	1.15034938	0.77625397	1.544092503	1.373955456	1.544092503	0	neutral	-1.266876313034323	../../group_analysis/rememberedneutral_faceperiod/B07277.nii
B07277	F	84	OA	0	0.017114777	0.939920986	0.831710016	0.831710016	1.15034938	0.77625397	1.544092503	1.373955456	1.544092503	0	loss	-1.266876313034323	../../group_analysis/rememberedloss_faceperiod/B07277.nii

Tom,

Do the groups differ in "da_group_norm"? If they do, it might be crucial to center "da_group_norm" within each group.

In addition, try the following steps.

(1) Change the label for the first column of the data table from "subject" to "Subj".

(2) Add a space before each colon (:) on every line below.

      -num_glt 13 \
      -gltLabel 1 OA_vs_YA -gltCode 1 'group: 1*OA -1*YA' \
      -gltLabel 2 Rew_vs_Loss -gltCode 2 'valence: 1*reward -1*loss' \
      -gltLabel 3 Rew_vs_Neu -gltCode 3 'valence: 1*reward -1*neutral' \
      -gltLabel 4 Loss_vs_Neu -gltCode 4 'valence: 1*loss -1*neutral' \
      -gltLabel 5 OA_Rew_vs_Loss -gltCode 5 'group: 1*OA valence: 1*reward -1*loss' \
      -gltLabel 6 YA_Rew_vs_Loss -gltCode 6 'group: 1*YA valence: 1*reward -1*loss' \
      -gltLabel 7 age_by_valence_interaction -gltCode 7 'group: 1*OA -1*YA valence: 1*reward -1*loss' \
      -gltLabel 8 OA_da_by_valence_interaction -gltCode 8 'group: 1*OA valence: 1*reward -1*loss da_group_norm:' \
      -gltLabel 9 YA_da_by_valence_interaction -gltCode 9 'group: 1*YA valence: 1*reward -1*loss da_group_norm:' \
      -gltLabel 10 age_da_valence_3way_interaction -gltCode 10 'group: 1*OA -1*YA valence: 1*reward -1*loss & 1*reward -1*neutral da_group_norm:' \
      -gltLabel 11 age_at_highDA -gltCode 11 'group: 1*OA -1*YA da_group_norm: 3' \
      -gltLabel 12 age_at_midDA -gltCode 12 'group: 1*OA -1*YA da_group_norm: 0' \
      -gltLabel 13 age_at_lowDA -gltCode 13 'group: 1*OA -1*YA da_group_norm: -3' \

Gang

Thanks so much Gang! I've got it working now!

Regarding your question about centering the "da_group_norm" variable, yes the groups have significantly different means. To account for this, I created the da_group_norm column as a Z-score for each group (OA and YA) separately. Therefore, the values I've included in the data table should be centered at 0 for each group. I believe this is the correct way to do this, but please let me know if I seem to be misunderstanding something.

For GLTs #8-10, I also had to specify a value for da_group_norm, so the final argument looks like this:

-gltLabel 8 OA_da_by_valence_interaction -gltCode 8 'group : 1*OA valence: 1*reward -1*loss da_group_norm : 0' \
-gltLabel 9 YA_da_by_valence_interaction -gltCode 9 'group : 1*YA valence : 1*reward -1*loss da_group_norm : 0' \
-gltLabel 10 age_da_valence_3way_interaction -gltCode 10 'group : 1*OA -1*YA valence : 1*reward -1*loss & 1*reward -1*neutral da_group_norm : 0' \

I believe this looks for differences between groups and reward conditions when the da_group_norm value is equal to zero? (The group mean.) If I am interested in more general interaction effects rather than a t-test at a specific value, should I use the GLF flags instead?

(P.S. This might be deviating from the topic of the original post. Let me know if I should start a new thread elsewhere!)

The first two lines of specifications align with your intended outcome. An equivalent result can be achieved by simply removing da_group_norm : 0 from those two lines.

If I am interested in more general interaction effects rather than a t-test at a specific value, should I use the GLF flags instead?

Yes, the number 10 specification should be changed to -glf for the interaction between group and valence. For the interaction among group, valence and da_group_norm, add the following

-glfCode ... 'group : 1*OA -1*YA valence : 1*reward -1*loss & 1*reward -1*neutral da_group_norm :' \

Gang

1 Like