Apologies if the answer to this is obvious, but I can't understand why the usual interpretation of the p-value (probability under the null model of obtaining a test statistic at least as unlikely as the one observed) is valid in a simple one-sample z-test.
As an example, say have some data with mean 2 and std of the mean of 1, and we want to test if the data is greater than 0. This gives a z-score of 2, which we can look up in a table to obtain p=0.023. This corresponds to the shaded area below.
What confuses me is that this seems to be the probability of drawing at most the mean of the null model (0) given a distribution inferred from the data (N(2, 1)), whereas the usual meaning of the p-value would be the probability of drawing at least 2 from a null model as illustrated below:
I can see that these are the same if we assume the null model to have the same width as the distribution we obtain from the data. Is this just an assumption of the test, or is there some deep reason to expect this to be the case?