Hi AFNI experts,
What is the most efficient way to explore voxel-wise correlations with an independent variable related to our in-scanner task output?
Thanks so much,
Carly
Hi AFNI experts,
What is the most efficient way to explore voxel-wise correlations with an independent variable related to our in-scanner task output?
Thanks so much,
Carly
Hi Carly,
You can use either 3dttest++ or 3dTcorr1D to do brain-behavior (or any metric really) correlations:
3dTcorr1D example
3dttest++ example
These examples were written ages ago and could probably have been clearer. If you go the 3dttest++ route you need to then convert the t-score to R. For this reason I often find 3dTcorr1D more straightforward.
Hi there,
Thank you so much for providing those examples. I have opted to pursue the 3dTcorr1D option. After running the steps in the example and opening the new file in afni, there are two options for Olay - PearCorr #1 and PearCorr #2. Are you able to clarify which I should be using?
Thanks so much,
Carly
Sounds like you had more than one column in your 1D/txt file that you provided 3dTcorr1D. Can you provide some of that file and the command you used?
Hi there,
Yes, I had one column for ID and a second column for my behavioural variable. I've copied and pasted a couple of rows below.
Thanks,
Carly
1002 1.65
1003 1.6
1004 1.6
1005 0.9
1007 1.65
1008 1.86
1009 2.1
1010 1.1
1011 1.8
1013 1.75
1014 1.53
1015 2.2
1016 1.41
1017 1.7
1018 1.19
1020 1.49
Apologies, I just noticed you asked for the command as well.
3dbucket -prefix AVOIDall_visual+tlrc
1002/1002.results/stats.1002_prevTRincl+tlrc'[13]'
1003/1003.results/stats.1003_prevTRincl+tlrc'[13]'
1004/1004.results/stats.1004_prevTRincl+tlrc'[13]'
1005/1005.results/stats.1005_prevTRincl+tlrc'[13]'
1007/1007.results/stats.1007_prevTRincl+tlrc'[13]'
1008/1008.results/stats.1008_prevTRincl+tlrc'[13]'
1009/1009.results/stats.1009_prevTRincl+tlrc'[13]'
1010/1010.results/stats.1010_prevTRincl+tlrc'[13]'
1011/1011.results/stats.1011_prevTRincl+tlrc'[13]'
1013/1013.results/stats.1013_prevTRincl+tlrc'[13]'
1014/1014.results/stats.1014_prevTRincl+tlrc'[13]'
1015/1015.results/stats.1015_prevTRincl+tlrc'[13]'
1016/1016.results/stats.1016_prevTRincl+tlrc'[13]'
1017/1017.results/stats.1017_prevTRincl+tlrc'[13]'
1018/1018.results/stats.1018_prevTRincl+tlrc'[13]'
1020/1020.results/stats.1020_prevTRincl+tlrc'[13]'
1021/1021.results/stats.1021_prevTRincl+tlrc'[13]'
1023/1023.results/stats.1023_prevTRincl+tlrc'[13]'
1024/1024.results/stats.1024_prevTRincl+tlrc'[13]'
1025/1025.results/stats.1025_prevTRincl+tlrc'[13]'
1026/1026.results/stats.1026_prevTRincl+tlrc'[13]'
1028/1028.results/stats.1028_prevTRincl+tlrc'[13]'
1029/1029.results/stats.1029_prevTRincl+tlrc'[13]'
1030/1030.results/stats.1030_prevTRincl+tlrc'[13]'
1031/1031.results/stats.1031_prevTRincl+tlrc'[13]'
1032/1032.results/stats.1032_prevTRincl+tlrc'[13]'
1034/1034.results/stats.1034_prevTRincl+tlrc'[13]'
1035/1035.results/stats.1035_prevTRincl+tlrc'[13]'
1037/1037.results/stats.1037_prevTRincl+tlrc'[13]'
1038/1038.results/stats.1038_prevTRincl+tlrc'[13]'
Followed by:
3dTcorr1D -prefix AVOcorr_Omax -mask mask_group+tlrc AVOIDall_visual+tlrc Omax.txt [1] {1..$}
Thanks!
Hmm, something funny is going on. I would suggest putting the indexing in single quotes in case the shell is doing something funny:
Omax.txt '[1]{1..$}'
or
Omax.txt '[1]''{1..$}'
You can also verify the shell's behavior by using 1dcat to make sure only one column is going into 3dTcorr1D. Worth checking the output of 3dTcorr1D because it should also tell you what's going on. For example if I pass two columns to 3dTcorr1D I get the following output:
++ 3dTcorr1D: AFNI version=AFNI_23.2.04 (Aug 15 2023) [64-bit]
++ Number of voxels in mask = 176037
+ reading dataset file D2_T2+tlrc.
+ reading 1D file MY_Behavior.txt[1..2]{1..$}
++ 1D file MY_Behavior.txt[1..2]{1..$} has 2 columns: correlating with ALL of them!
++ ysim has 2 columns: correlating with ALL of them!
+ loading dataset ./D2_T2+tlrc.BRIK into memory
++ Start correlations: 176037 voxels X 2 time series(16); 10 threads
[0][1]
The columns will be in order of your behavioral file, so PearCorr#0 is the first column it gets, PearCorr#1 is the second and so on. That said I tend to just do one at a time because it's easier to script and keep file names clear of what the output really is.
The output generated should have a single sub-brik. Example:
Ahh, that was very helpful - thank you! I previously removed the headers from the covariate file as I kept getting errors. As such, it seems if I just include [1] for indexing, it will only read the second column. ( 3dTcorr1D -prefix AVOcorr_Omax_visual -mask mask_group+tlrc AVOIDall_visual+tlrc Omax.txt[1] )
Does this look proper?
Thanks so much,
Carly
That looks correct!
You can pass the -ok_1D_text
to 3dTcorr1D to avoid those errors.
Also a gentle reminder that Brik files order (the 3dbucket command) need to be in the same order as the data in your behavioral file. It looks like yours are - but I always verify it.
Thank you so much! I really appreciate your time and patience.
Is a way to know what level of cluster and p-value I would require for a FWE correction (similar to 3dclustsim) for this correlational analysis?
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.
Freedom of Information Act |
HHS Vulnerability Disclosure
National Institute of Mental
Health | National Institutes of Health | U.S.
Department of Health and Human Services |