ShowAxes(false)
SetVisibleInView(xOyPlane,-1,false)
eq1:z=0
SetColor(eq1,"blue")
n1=3*Vector((0,0,0),(0,0,1))
SetColor(n1,"blue")
eq2:x-y+2*z=0
SetColor(eq2,"red")
n2=3/sqrt(6)*Vector((0,0,0),(1,-1,2))
SetColor(n2,"red")
v=3/sqrt(2)*Vector((0,0,0),(1,1,0))
t=slider(0,pi/2,pi/100)
Rotate(n1,t,(0,0,0),v)
Rotate(n2,t,(0,0,0),v)
StartAnimation(t)
p=slider(0.01,0.99,0.01)
n=50
sampleSuccess=35
phat=sampleSuccess/n
SDnull=sqrt(p*(1-p)/n)
f(x)=1/(SDnull*sqrt(2*pi))*e^(-0.5*((x-p)/SDnull)^2)
ShowLabel(f,false)
a=p-2*SDnull
b=p+2*SDnull
c=Integral(f(x),a,b)
SetLabelMode(c,2)
x=p
ShowLabel(eq1,false)
x=phat
ShowLabel(eq2,false)
ZoomIn(-0.1,-2,1.1,20)
ShowGrid(false)
t=Text("pi is plausible",(p+0.01,f(p)+1))
SetConditionToShowObject(t,a<phat&&phat<b)
Text(RotateText("p-hat = prop. of success in sample",pi/2),(phat-0.04,20),true,true)
Text(RotateText("pi = prop. of success in population",pi/2),(p-0.04,20),true,true)
ci=Segment((0.56,0),(0.81,0))
SetColor(ci,"red")
SetLineThickness(ci,12)
SetCaption(ci,"95% conf. interval")