science-notes/source/statistics/code/ztest_pvalue.R
2023-10-18 17:43:35 +02:00

10 lines
255 B
R

N=rnorm(9999999,mean=0,sd=1)
cdf=ecdf(N)
zscore=-1.8
message(paste0("Alpha approximated is ",cdf(zscore)))
message(paste0("Alpha from built-in CDF ",pnorm(zscore,mean=0,sd=1)))
message(paste0("Bonus: zscore from p-value ",qnorm(0.02275,mean=0,sd=1)))