简体   繁体   中英

What is the R equivalent to Excel's =2*NORMSDIST(2)

In Excel =2*NORMSDIST(2) puts out ~1.96. How do I get that same value in R?

If you want to get the two-sided 95% confidence limit for a z-score, you would use =NORMSINV(0.975) (which is =NORMSINV(1 - (1-0.95)/2) ). The fact that your formula gives approximately the same number is nothing more than a coincidence.

The equivalent in R would be qnorm(0.975) or qnorm(1 - (1-0.95)/2) .

You can get that value in R with

2*pnorm(2)

The pnorm() function is the cumulative density function for a normal random variable

在此输入图像描述

Which is consistent with the description of the Excel NORMDIST function

NORMSDIST(z) returns the probability that the observed value of a standard normal random variable will be less than or equal to z. A standard normal random variable has mean 0 and standard deviation 1 (and also variance 1 because variance = standard deviation squared).

R Equivalent for =NORMSDIST(2) is pnorm(2)

R Equivalent for =NORMSINV(0.95) is qnorm(0.95)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM