Finding the p-value in a proportion statistics with binomial distribution Given that the sample is 40, we observed that 80% of the sample (32 participants) have a successful trial.
We want to test the hypothesis $H_{0} = p_{0} = 0.7$ versus $H_{a} \neq 0.7$ at 5% significance level.
I would to calculate the $p$-value.

My attempt
Let X be the distribution under the nul hypothesis, where X ~ Bin(n,$p_{0}$), i.e. $P(X=x)= \binom{n}{x}(p_{0})^{x}(1-p_{0})^{40-x}$. 


*

*For values less than the observed test statistic, i.e. for $x \lt 32$: $p$-value $= 2 * P(X \leq x)$.

*For $x =32$: p-value = 1.

*For values greater than the observed test statistic i.e. for $x \gt 32$:$p$-value $= 2 * P(X \geq x)$.
However, i am getting p-values greater than 1, wish is wrong. i am wondering if there is any logical error in my testing.
 A: $p$-value is a probability that a random sample from the distribution that corresponds to null-hypothesis will show the "worst" results than we have seen for tested sample. The worst here means that the observed number of successful trials will be at least as far as 32 from the expected number under null hypothesis. The expected number of successes is $40\times 0.7=28$. In other words, $p$-value is a probability that $|X-28|\geq |32-28|=4$ given $X\sim Bin(n,p_0)$.
We need to calculate the probability of this event
$$P(X\leq 28-4 \vee X\geq 28+4)=P(X\leq 24 \vee X\geq 32)=P(X\leq 24) + P(X\geq 32).$$
The distribution of $X$ is not symmetric, and the tail probabililties are not equal. 
So one can use Central Limit Theorem to find approximate value of this probability or just add up the probabilities $P(X=x)= \binom{n}{x}(0.7)^{x}(0.3)^{40-x}$ over integer $x$ from $25$ to $31$ and then subtract the result from $1$:
$$
P(|X-28|\geq 4)=P(X\leq 24 \vee X\geq 32)=1-P(25\leq X \leq 31).$$
The Binomial distribution is symmetric only when $p_0=0.5$. This is not the case. But if you will use normal approximation to find $p$-value, then by the symmetry of normal distribution you can  simply multiplied the approximate value $P(X\geq 32)$ by two: 
$$p-\text{value} = P(X\leq 24)+P(X\geq 32) = P\left(\frac{X-np_0}{\sqrt{np_0(1-p_0)}}\leq \frac{24-28}{\sqrt{28\times 0.3}}\right) + P\left(\frac{X-np_0}{\sqrt{np_0(1-p_0)}}\geq \frac{32-28}{\sqrt{28\times 0.3}}\right)$$
Both summands are approximately equal. Then
$$p-\text{value} \approx 2\Phi(-1.38)=0.1676.$$
