Need to create plot for Confidence Interval Coverage

I need to create a plot to show the Wald Interval Coverage. The code for the coverage works good, however, I do not know how to plot the results. The plot should show that Wald Interval does not cover 99% of values, it covers only 90% or 97%. Please see the code below. Any help is much appreciated.

for (i in 1:m)
{
y=rbinom(1,n1,p1)
phat[i]=y/n1
se[i]=sqrt((phat[i]*(1-phat[i]))/n1)
}

coverage1=sum((phat-2.576se<=p1)&
(phat+2.576
se>=p1))/m

for (i in 1:m)
{
y=rbinom(1,n2,p2)
phat[i]=y/n2
se[i]=sqrt((phat[i]*(1-phat[i]))/n2)
}

coverage2=sum((phat-2.576se<=p2)&
(phat+2.576
se>=p2))/m

for (i in 1:m)
{
y=rbinom(1,n3,p3)
phat[i]=y/n3
se[i]=sqrt((phat[i]*(1-phat[i]))/n3)
}

coverage3=sum((phat-2.576se<=p3)&
(phat+2.576
se>=p3))/m
coverage1
coverage2
coverage3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.