Negative values for Cohen's f^2

Precompiled binary linux_rocky_8: Dec 21 2023 (Version AFNI_23.3.14 'Septimius Severus')


Hi. Thank you again for adding the -R2 option to 3dLMEr. I used it to calculate an effect size for my quantitative variable (auditory arousal threshold [AAT]) in my LME model. To refresh your memory, I measure AAT periodically during all-night functional MRI sleep studies and currently use the last four minutes of functional MRI data before each arousal. I would like your thoughts on a few things, and please give me a little latitude in this discussion.

Using the same mathematical steps outlined for this procedure when using SAS [1], I estimated Cohen's f^2 by subtracting the proportion of variance explained by R^2 in a reduced model without AAT from a full model with AAT. See below for my code.

Is the R^2 value produced by 3dLMEr ordinary or adjusted (i.e., adjusted for the number of fixed-effects coefficients)? From my previous request [2], I assume you used the r.squaredGLMM function in R's MuMIn package. From my reading of its documentation [3], I was able to deduce with relative confidence that it is ordinary. Is that your understanding? Either way, might you know why the majority of my obtained Cohen's f^2 values across all voxels in my maps would be negative? It is possible for the variance explained by a model to decrease when adding a variable to it, but this is rare.

The reason I am starting with ordinary versus adjusted R^2 as the possible cause is that my colleague and I, mostly my colleague Nils Yang, did a similar analysis on the same data with Matlab's fitlme function and experienced something similar. When using adjusted R^2, most Cohen's f^2 values were negative. When this was changed to ordinary R^2, most were positive as I would expect.



[1] Selya, A. S., Rose, J. S., Dierker, L. C., Hedeker, D., & Mermelstein, R. J. (2012). A practical guide to calculating Cohen's f(2), a measure of local effect size, from PROC MIXED. Frontiers in Psychology, 3, 111.




for (( h=0 ; h<${#my_model[@]} ; ++h )) ; do
    3dLMEr \
        -prefix output_lme_audaro_${region}${regsiz}_${prepro}_${statin}${my_suffix[h]}.nii \
        -jobs 32 \
        -model "${my_model[h]}" \
        -qVars 'AAT' \
        -R2 \
        -SS_type 3 \
        -gltCode AATeff 'AAT : ' \
        -dataTable \
        Subj    cond    AAT     InputFile \
    sb=(5 6)
    sb_reduced=(4 5)
    my_suffix=(fix fixplusran)
    for (( j=0 ; j<${#my_suffix[@]} ; ++j )) ; do
        3dcalc \
            -a ${my_olay[i]}"[${sb[j]}]" \
            -b $(echo ${my_olay[i]} | sed 's/\.nii//')_reduced.nii"[${sb_reduced[j]}]" \
            -expr "(a-b)/(1-a)" \
            -prefix ${my_prefix}_aatf2_${my_suffix[j]}.nii

Hi Dante,

Is the R^2 value produced by 3dLMEr ordinary or adjusted (i.e., adjusted for the number of fixed-effects coefficients)?

The R^2 values presented by 3dLMEr rely on the r.squaredGLMM function from R's MuMIn package, as per your suggestion. The 3dLMEr output includes two types of R^2 values: conditional and marginal. Do these align with the two categories (ordinary or adjusted) you're mentioning?

Gang Chen

1 Like


Hi again. Happy New Year. Thank you for your help and dedication.

No, it does not. With some help from Nils, I discovered that both marginal and conditional are ordinary R^2. Please let me think about this. I still very much do not understand why most of my Cohen's f^2 values are negative.