beta/or, se, p, zscore换算总结帖(20211014更新)

对GWAS的summary文件进行整合时,经常需要在beta,or, se, p, zscore之间进行换算,故在此总结一下​。希望对大家有帮助。

1. se 计算

1.1 有 beta、p ,计算se;

se=sqrt(((beta)^2)/qchisq(p,1,lower.tail=F))

1.2 有 or、p ,计算se;

se=abs(log(or)/qnorm(p/2))

1.3 有 freq、zscore、N ,计算se;

se <- 1/sqrt((2*freq)*(1-(freq))*(N+(zscore^2)))

2. beta 计算

2.1 有 freq、zscore、N ,计算beta;

beta <- zscore*(1/sqrt((2*freq)*(1-(freq))*(N+(zscore^2))))

3. zscore计算

3.1 有 beta、p ,计算zscore;

c=-qnorm(p/2)

情况1:beta > 0,zscore = c
情况2:beta < 0,zscore = -c

3.2 有 or、p ,计算zscore;

c=qnorm(1-p/2)

情况1:or > 1,zscore = c
情况2:or < 1,zscore = -c

3.3 有 beta、se ,计算zscore;

zscore=beta/se

3.4 有 or、se ,计算zscore;

zscore=log(or)/se

注意:这里的se指的是log(or)的se,plink给出的se就是默认log(or)的se

4. beta 和 OR 的转换

4.1 beta to OR:

Beta = log(OR)

4.2 OR to beta:

OR = exp(beta)

Assuming the confidence interval being used is 95%,the upper and lower bounds for the OR:

upper bound of OR = OR + se(OR) x 1.96
lower bound of OR = OR - se(OR) x 1.96
Log(upper bound of OR) = upper bound of beta
Log(lower bound of OR) = lower bound of beta
upper bound of beta = beta + se(beta) x 1.96
lower bound of beta = beta - se(beta) x 1.96
If you have the 95% C.I of beta, then calculating the SE(beta) is quite simple!
for example if beta = 0.5 and the upper C.I is 0.6 then
upper C.I of beta = beta + se(beta) x 1.96
0.6 = 0.5 + se x 1.96

以上所有的公式换算均在R环境下完成的。
此文感谢彭师姐和蔡大胖同学参与的讨论,以及 https://www.researchgate.net/post/How_can_I_calculate_beta_coefficient_and_its_error_from_Odds_Ratio_from_GWAS_summary_Statisitcs

posted @ 2021-03-04 22:52  橙子牛奶糖  阅读(35632)  评论(5编辑  收藏  举报