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.

[list=1] [*] [b]The confidence interval.[/b] The green line shows the 95% confidence interval for μ, based on a sample mean [math]\bar{x}[/math] and standard error [math]\frac{σ}{\sqrt{n}}[/math]. Drag the green point to see what happens as [math]μ_0[/math] changes. [*] [b]The null distribution.[/b] Click '[b]Show null distribution[/b]' to show the distribution of [math]\overline{X}[/math] under the null hypothesis [math]H_0 : μ = μ_0[/math]. The shaded areas in the tails represent the p-value for a 2-sided hypothesis test. Click '[b]Show p-value[/b]' to see its numerical value. Drag the point [math]μ_0[/math] to see how the p-value changes as the difference [math]μ_0 − \bar{x}[/math] changes. Click the 'play' button to make it animate! [*] [b]The p-curve.[/b] Drag the point [math]μ_0[/math] to change the hypothesised value of the population mean [math]μ_0[/math]. Observe how the p-value changes as [math]μ_0 − \bar{x}[/math] changes. [/list] You can change the confidence level by typing a value in the box for [math]\alpha[/math] or dragging the dashed grey line in the top plot. How does this affect the confidence interval? How does it affect the p-curve?