Hypothesis Testing

P-value

Manipulate[
IntegralPlot[PDF[NormalDistribution[5, Sqrt[1000/(12n)]],x], {x,0,10},{0,m},PlotRange->{0,2},AxesLabel->{"(OverBar[X])","f(OverBar[X])"}, PlotLabel->"P-value of One-tailed Z-test for different n"],
{{n,1,"sample size"}, 1,2000,1, Appearance->"Labeled"},
{{m,0,"mean of the data"},0,10,0.01}]

Manipulate[
Integral2Plot[PDF[NormalDistribution[5, Sqrt[1000/(12n)]],x], {x,0,10},{0,Min[m,10-m]},{Max[m,10-m],10},PlotRange->{0,2},AxesLabel->{"(OverBar[X])","f(OverBar[X])"}, PlotLabel->"P-value of Two-tailed Z-test for different n"],
{{n,1,"sample size"}, 1,2000,1, Appearance->"Labeled"},
{{m,1,"mean of the data"},0,10,0.01}]

Draw OC Curves

Manipulate[
Plot[CDF[NormalDistribution[0,1],InverseCDF[NormalDistribution[0,1],1-α/2]-Abs[d]*√n]-CDF[NormalDistribution[0,1],InverseCDF[NormalDistribution[0,1],α/2]-Abs[d]*√n],{d,-5,5},PlotRange->{0,1},AxesLabel->{"d","P[fail to reject (Subscript[H, 0])]"}, PlotLabel->"OC Curve of Two-tailed Z-test for different n"],
{{n,1,"sample size"}, 1,250,1, Appearance->"Labeled"},
{{α,0.05,"α"},0.001,0.5,0.001}]

Manipulate[
Plot[CDF[NormalDistribution[0,1],InverseCDF[NormalDistribution[0,1],1-α]-d*√n],{d,-5,5},PlotRange->{0,1},AxesLabel->{"d","P[fail to reject (Subscript[H, 0])]"}, PlotLabel->"OC Curve of One-tailed Z-test for different n"],
{{n,1,"sample size"}, 1,250,1, Appearance->"Labeled"},
{{α,0.05,"α"},0.001,0.5,0.001}]

Manipulate[
Plot3D[CDF[NormalDistribution[0,1],InverseCDF[NormalDistribution[0,1],1-α]-d*√n],{n,1,100},{α, 0.001, 0.05},PlotRange->{0,1}, PlotLabel->"Power of One-tailed Z-test"],
{{d,0.5,"d"},0,5,0.001}]