R语言z-score转p.value

z-score计算方法为:
Z =(x-μ)/ σ
μ为均值,σ为标准差。

以下是R中将z-score转为p.value的方法:

pnorm(q, mean = 0, sd = 1, lower.tail = TRUE)
q就是z-score;

zscore = 12.7

# Left-tailed test
pnorm(q=zscore, lower.tail=TRUE)

# Right-tail test
pnorm(q=zscore, lower.tail=FALSE)

# Two-tailed test
2*pnorm(q=zscore, lower.tail=FALSE)

个人最常用的是双边检验(two-tailed test).

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章