Hello, I am having some problems trying to figure out how to code up my 3dMVM code for this specific situation. This is my first time coding a 3dMVM command so sorry for this basic stuff.
The situation is, I have a within-subject design with 3 timepoints. Mice undergo a resting state scan after a 1. baseline session, 2. injection with vehicle, and 3. injection with CGRP. There are no between subject variables of interest in this study. We want to control for sex.
In terms of statistical tests, I would like one f-test per condition, and a t-test for each possible contrast between baseline, vehicle, and cgrp (of which there are 3 total).
Because sex is of no interest to us except as something to control for, I was unsure of how to use the -bsVars or how to include the sex variable in my glts and glfs. Basically I think my command is a mess. Can someone give me suggestions or comments about how to optimize my code?
Hi Gang, I've got a follow-up question.
After editing my code, running it gives the following error:
Error in if (len%%wd != 0) errex.AFNI(paste("The content under -dataTable is not rectangular !", :
argument is of length zero
Calls: process.MVM.opts
Execution halted
I've gone through my datatable and checked for extra spaces and other problems but nothing I changed helped. I also resaved the file in excel, and also tried to include the table as part of the original code as in the examples in the help but I keep getting the same error. Am I missing something simple? my code for the script is as follows:
I updated my afni binaries right before running this again so I am now running the most up-to-date afni Precompiled binary macos_13_ARM_clang: Jul 11 2024 (Version AFNI_24.1.22 'Publius Septimius Geta')
I don't believe the error message changed at all. Trying to run this script gives the following:
Error in if (len%%wd != 0) errex.AFNI(paste("The content under -dataTable is not rectangular !", :
argument is of length zero
Calls: process.MVM.opts
Execution halted
OH GOSH, I actually fixed my own problem but have run into some more errors. Let me try to address this and see if I can close this. So sorry to bother you with these posts.
Edit 3:35 CST:
So I got the command to run and am now running into the following error:
++Good: Table is regular and rectangular.
Read 139 items
Dimensions:
rows: 27 | columns: 4
Data summary:
Variable Detected_Type Details
Subj Subjects Num Subjects=9
sex Categorical Counts: female=9 | male=18
condition Categorical Counts: baseline=9 | cgrp=9 | vehicle=9
InputFile Data Number of InputFiles=27
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
Warning messages:
1: package ‘lme4’ was built under R version 4.3.3
2: In check_dep_version() : ABI version mismatch:
lme4 was built with Matrix ABI version 1
Current Matrix ABI version is 0
Please re-install lme4 from source or restore original ‘Matrix’ package
Loading required package: car
Loading required package: carData
Error in str2lang(x) : :1:8: unexpected input
1: Beta ~ “
^
Calls: as.formula -> formula -> formula.character -> str2lang
Execution halted
Is this a problem with my variables? Again, so sorry for all this.
++Good: Table is regular and rectangular.
Read 139 items
Dimensions:
rows: 27 | columns: 4
Data summary:
Variable Detected_Type Details
Subj Subjects Num Subjects=9
sex Categorical Counts: female=9 | male=18
condition Categorical Counts: baseline=9 | cgrp=9 | vehicle=9
InputFile Data Number of InputFiles=27
++ Good: All InputFiles exist.
++ Good: All InputFiles have exactly 1 volume.
++ Good: All InputFiles are on the same grid.
+* Warning: Log file: /Users/shittyjewel/Desktop/LEVI/MVM_test/groupAnalyses/3dMVM/CGRP_MVM_results_log.txt exists! NOT OVERWRITING!!
Loading required package: lme4
Error: package ‘Matrix’ required by ‘lme4’ could not be found
In addition: Warning message:
package ‘lme4’ was built under R version 4.3.3
Execution halted
++Good: Table is regular and rectangular.
Read 139 items
Dimensions:
rows: 27 | columns: 4
Data summary:
Variable Detected_Type Details
Subj Subjects Num Subjects=9
sex Categorical Counts: female=9 | male=18
condition Categorical Counts: baseline=9 | cgrp=9 | vehicle=9
InputFile Data Number of InputFiles=27
++ Good: All InputFiles exist.
++ Good: All InputFiles have exactly 1 volume.
++ Good: All InputFiles are on the same grid.
+* Warning: Log file: /Users/shittyjewel/Desktop/LEVI/MVM_test/groupAnalyses/3dMVM/CGRP_MVM_results_log.txt exists! NOT OVERWRITING!!
I think you've solved my many problems! Thank you so much for sticking with me on this, I really appreciate your help; especially since I never would have seen that quote issue if I stared at it for hours.
Thanks! this should be closed now, i think.
lauren
To check scripts for bad characters (such as non-ASCII ones, like this fancy quote mascarading as a simple quote), Rick wrote a program called file_tool. It is quite helpful for seeing where these things are occurring:
file_tool -show_bad_all -infiles SCRIPT
Usually text editors have options to turn off things like "convert quotations". Dashes can also cause subtle woe in the same way.
Copy+pasting from email or PDFs can lead to subtle character issues like this. Some macOS editors try to be particularly "helpful" and prettify text, but these changes tend to be bad for scripting.
I'm glad this was found here, but it is indeed really tricky to find sometimes.
Yeah, that was exactly the issue, I wrote the script in a mac text editor on my break and then c/p'd it over. I'm glad to know about this tool now, to hopefully avoid these issues in the future (thanks mac).
Thanks Paul and Gang!
The
National Institute of Mental Health (NIMH) is part of the National Institutes of
Health (NIH), a component of the U.S. Department of Health and Human
Services.