Nabisco claims the mean number of chocolate chips in an 18oz bag of cookies is 1150 with a standard deviation of 180 chips. Are they lying?
Our strategy is to gather data and then determine if the data is inconsistent with Nabisco’s claim.
So the first thing to imagine is the population of all bags of chocolate chip cookies. At this point we have no reason to believe Nabisco is lying. So you might have a picture like this.
muu <- 1150
sigm <- 180
n <- 32
(xbar <- 1095)
## [1] 1095
xbar2 <- 1065
n2 <- 10
(se2 <-sigm/sqrt(n2))
## [1] 56.921
(se <-sigm/sqrt(n))
## [1] 31.81981
(z <-(xbar - muu)/se)
## [1] -1.728483
shadenorm(mu = muu, sig = sigm, below = -1, col = "blue", dens = 0)

Or you may just have a picture like this:
\(\Large{\mu}= 1150, \Large{\sigma} = 180\)
From a random sample of 32 bags we find a sample mean of 1095 chocolate chips.
Statistical theory allows us to know the probability of all possible outcomes to our experiment.
Statistical theory says:
\(\Large\overline{X_n} \sim \mathcal{N} (\mu,\frac{\sigma}{\sqrt{n}})\)
Caveat is that the sample size is 30 or larger or population is Normal.
Armed with this information we are now able to determine if our data is likely or unlikely under the assumption that Nabisco is telling the truth.
Our logic will be as follows.
If this data is unlikely that is evidence that Nabisco is lying.
This shaded area is the probability of obtaining a sample mean less then 1095 under the assumption Nabsisco is telling the truth.
shadenorm(mu = muu, sig = se, below = xbar, col = "blue", dens = 200)

Our strategy of obtaining this probablity is to find the appropriate Z value such the area to left of it is exactly the area we are looking for.
\(\Huge z = \Huge\frac{\bar{x}-\mu}{\frac{\sigma}{\sqrt{n}}} = \Huge\frac{1095-1150}{\frac{180}{\sqrt{32}}} = -1.72\)
shadenorm(mu = 0, sig = 1, below = z, col = "blue", dens = 200)

pnorm(z,mean = 0, sd = 1)
## [1] 0.04195081
Backwards problem.
Consumer Reports magazine says that if the probability of your data is less then .05 that is evidence that Nabisco is lying.
According to Consumer Reports what is the maximum \(\Large\bar{x}\) you could observe and still claim they are lying? Assume a sample size of 32.
Strategy is to find the Z value that corresponds to .05. Then convert that Z value to a \(\large\bar{x}\).
From the table the corresponding Z value is - 1.64.
\(z = \huge\frac{\bar{x}-\mu}{\frac{\sigma}{\sqrt{n}}} = -1.64\)
Plugging in 1150 for \(\mu\), 180 for \(\sigma\) and 32 for n and solving for \(\bar{x}\)
\(\huge\bar{x} = \huge\frac{z\sigma}{\sqrt{n}} + \mu\)
\(\huge\bar{x} = \huge\frac{(-1.64)(180)}{\sqrt{32}} + 1150\)
\(\huge\bar{x}=\) \(1098\)
Conceptual point. This picture shows how obtaining a sample mean less then 1065 is more likely then obtaining a sample mean less then 1095. (From a population with a mean of 1150)

pnorm(xbar,mean = muu, sd = se )
## [1] 0.04195081
pnorm(xbar2,mean = muu, sd = se2 )
## [1] 0.06767963