Confidence intervals, hypothesis testing and p-values

This illustrates the connection between a confidence interval, a formal hypothesis test, and the p-value of a hypothesis test.
  1. The confidence interval. The green line shows the 95% confidence interval for μ, based on a sample mean and standard error . Drag the green point to see what happens as changes.
  2. The null distribution. Click 'Show null distribution' to show the distribution of under the null hypothesis . The shaded areas in the tails represent the p-value for a 2-sided hypothesis test. Click 'Show p-value' to see its numerical value. Drag the point to see how the p-value changes as the difference changes. Click the 'play' button to make it animate!
  3. The p-curve. Drag the point to change the hypothesised value of the population mean . Observe how the p-value changes as changes.
You can change the confidence level by typing a value in the box for or dragging the dashed grey line in the top plot. How does this affect the confidence interval? How does it affect the p-curve?