R

Comparison of correlation coefficients

LaTex in markdown

Posted by Shsun on January 12, 2020

Z-test is a statistical test used to determine whether two population means are different. Using the Fisher transformation, we can test whether two correlation coefficients are significantly different. Z value is calculated as:
equations
Here’s what I wrote for compare correlation coefficients.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
r1 = cor1$estimate
r2 = cor2$estimate

if(abs(r1) < r.lim | abs(r2) < r.lim) next

n1 = sum(complete.cases(x1, x2))
n2 = sum(complete.cases(y1, y2))

# fisher transformation
fisher = ((0.5*log((1+r1)/(1-r1)))-(0.5*log((1+r2)/(1-r2))))/((1/(n1-3))+(1/(n2-3)))^0.5

p.value = (2*(1-pnorm(abs(fisher))))
if(p.value < plim){
  cor.dif[ilon,ilat] = r2 - r1
}

The cocor R package can also be used to compare two correlation coefficients.

How to insert LaTeX equations in markdown pages

Take your latex equation and go to http://www.codecogs.com/latex/eqneditor.php, copy the URL and paste that in your markdown script: ![equation](http://latex.codecogs.com/gif.latex)

How to draw diagrams in markdown

Draw diagrams with Markdown Markdown cheatsheet

Reference

Fisher, R. A. (1921). On the Probable Error of a Coefficient of Correlation Diedenhofen, B. & Musch, J. (2015). cocor: A Comprehensive Solution for the Statistical Comparison of Correlations. PLoS ONE, 10(4): e0121945. doi:10.1371/journal.pone.0121945 https://stackoverflow.com/questions/35498525/latex-rendering-in-readme-md-on-github