I'm learning the randomness test of the NIST SP 800-22 rev 1a documentation.
https://csrc.nist.gov/publications/detail/sp/800-22/rev-1a/final
As I was reading, a few questions came up and I put them up like this. My questions are:
In the Frequency Test within a Block of 2.2, looking at (3) of 2.2.4, there is a part that is calculated as follows. $$\chi^2(obs)=4M\sum_{i=1}^{N}(\pi_i - 1/2)^2$$ I don't understand why it's multiplied by 4 here.
In the Runs Test of 2.3, the p-value is calculated as $$P-value = erfc(\frac{|V_n(obs)-2n\pi(1-\pi)|}{2\sqrt{2n}\pi(1-\pi)}).$$ What is the value of the denominator here? I know that $2\pi(1-\pi)$ is the mean, but I don't know where the denominator came from.
Is there any reason to find the p-value through erf instead of the normal distribution in (2)?
Thank you.