With the function set up as above, it is straightforward to run the function, and come to a conclusion.
Suppose that we will reject the null hypothesis if the p-value is less that 0.05. Then, we simply run:
iq <- c(107, 113, 108, 127, 146, 103, 108, 118, 111, 119)z_test(data=iq, mean=100, sd=15)## [1] 0.0007432799
And so, we reject the null hypothesis that this classroom has an average IQ that is the same as the national population. We must be in Lake Wobegon.