# Hypothesis Testing - Simple

- Author:
- Linda Fahlberg-Stojanovska

- Topic:
- Hypothesis Testing, Statistics

How does hypothesis testing work with the standardized, normalized function in tables?
In the left-hand graph, we have the normal curve of the actual problem.
(The curve is centered at the hypothesized mean miH and the standard error is the standard deviation divided by the square root of n.)
We calculate the critical value(s) for this curve using InverseNormal(miH,stderr,alpha/tailn) and InverseNormal(miH,stderr,1-alpha/tailn).
Then we

**directly check**our sample mean xbar to see if it is within (do NOT reject Ho) or outside (reject Ho). In the right-hand graph, we move to the standardized, normalized PDF (fs) and CDF (p) used in tables. We calculate the critical z value(s) using zc=InverseNormal(0,1,alpha/tailn). Automatically -zc is the other critical value. Then we**offset our sample mean xbar**. Here we used the formula directly offset=(difference in means)/stderr. (We could use ZMeanTest.) Finally, we**check the offset**to see if it is within (do NOT reject Ho) or outside (reject Ho).Use the checkbox at right to change between the PDF and CDF (p-value). Make sure you understand all the parts of these graphs.
Use the slider to see how changing the sample mean xbar changes the zstat (offset). Does it change more or less than the actual sample mean?
Use the slider to see how changing the sample size n affects the graphs. What changes on which graph? Does increasing the sample size mean a greater possibility for rejection or a smaller possibility?
Can you write an interesting question to ask your fellow student?
Here is the R code for standardized, normalized.
#Givens
#Assume normal distribution
miH=3
sig=0.9
#Assume confidence interval 95%.
alpha=0.05
#Assume Ho: miH=3 so 2 tails
tailn=2
#Reject or not reject?
n=15
xbar=2.78
stderr=sig/sqrt(n)
zc=qnorm(alpha/tailn)
offset=(xbar-miH)/stderr
NotReject= (zc<=offset)&&(offset<=-zc)
NotReject
#miH is the hypothesized mean.
#n is the sample size
#sig is the standard deviation
#stderr=standard error
#zc is the standardized, normalized critical z for given significance.