Skip to content

Instantly share code, notes, and snippets.

@jcheong0428
Created September 15, 2018 03:21
Show Gist options
  • Save jcheong0428/e3cd3c2c13932a3c30ad910eca0424b4 to your computer and use it in GitHub Desktop.
Save jcheong0428/e3cd3c2c13932a3c30ad910eca0424b4 to your computer and use it in GitHub Desktop.
Correcting degrees of freedom from lmer output
# Correct p-value by adjusting degrees of freedom.
# Degrees of freedom is divided by two and then looked up
# Reference:
# https://www.ncbi.nlm.nih.gov/pubmed/27751943
# Chen, G., Taylor, P. A., Shin, Y. W., Reynolds, R. C., & Cox, R. W. (2017). Untangling the relatedness among correlations, Part II: Inter-subject correlation group analysis through linear mixed-effects modeling. Neuroimage, 147, 825-840.
from scipy.stats import t
tt = 9.83
df = 17.6/2.
pval = t.sf(np.abs(tt), df)*2
print(pval)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment