Cell[CellGroupData[{Cell[BoxData[ RowBox[{"Manipulate", "[", " ", RowBox[{ RowBox[{ RowBox[{"\[Alpha]Val", "=", RowBox[{"1", "-", "\[Alpha]Valbar"}]}], ";", " ", RowBox[{"Which", "[", RowBox[{"(*", RowBox[{ RowBox[{"method", "==", "\"\\""}], " ", ",", " ", " ", RowBox[{ RowBox[{"data", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"pp", ",", RowBox[{"coverageW", "[", RowBox[{"n", ",", "pp", ",", "\[Alpha]Val"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"pp", ",", "0.05", ",", ".5", ",", " ", ".001"}], "}"}]}], "]"}]}], ";", " ", RowBox[{"data", "=", RowBox[{"Join", "[", RowBox[{"data", ",", " ", RowBox[{ RowBox[{"Reverse", "@", "data"}], " ", "/.", " ", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", " ", "y_"}], "}"}], " ", ":>", " ", RowBox[{"{", RowBox[{ RowBox[{"1", "-", "x"}], ",", " ", "y"}], "}"}]}]}]}], "]"}]}], ";", " ", RowBox[{"pShow", "=", " ", RowBox[{ RowBox[{"Select", "[", RowBox[{"data", ",", " ", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "pval"}], "]"}], " ", "<", " ", ".00101"}], "&"}], ",", " ", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", " ", RowBox[{"Show", "[", RowBox[{ RowBox[{"ListLinePlot", "[", RowBox[{"data", ",", RowBox[{"PlotStyle", "->", "Blue"}], ",", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", "0.95"}], "}"}], ",", RowBox[{"{", RowBox[{"0.8", ",", "1.0"}], "}"}]}], "}"}]}], ",", RowBox[{"Frame", "->", "True"}], ",", " ", RowBox[{"FrameTicks", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}]}], "}"}]}], ",", " ", RowBox[{"RotateLabel", "->", "False"}], ",", RowBox[{"FrameLabel", "->", " ", RowBox[{"{", RowBox[{ "\"\\"", ",", " ", "\"\\""}], "}"}]}]}], "]"}], ",", " ", RowBox[{"Graphics", "[", RowBox[{"{", RowBox[{"Red", ",", " ", RowBox[{"PointSize", "[", ".02", "]"}], ",", RowBox[{"Point", "[", "pShow", "]"}]}], "}"}], "]"}]}], "]"}]}], ",", " ", " ", RowBox[{"method", "==", "\"\\""}], " ", ",", " ", " ", RowBox[{ RowBox[{"dataB", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"pp", ",", RowBox[{"coverageBones", "[", RowBox[{"n", ",", "pp", ",", "\[Alpha]Val"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"pp", ",", "0.05", ",", ".5", ",", " ", ".001"}], "}"}]}], "]"}]}], ";", " ", RowBox[{"dataB", "=", RowBox[{"Join", "[", RowBox[{"dataB", ",", " ", RowBox[{ RowBox[{"Reverse", "@", "dataB"}], " ", "/.", " ", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", " ", "y_"}], "}"}], " ", ":>", " ", RowBox[{"{", RowBox[{ RowBox[{"1", "-", "x"}], ",", " ", "y"}], "}"}]}]}]}], "]"}]}], ";", " ", RowBox[{"pShow", "=", " ", RowBox[{ RowBox[{"Select", "[", RowBox[{"dataB", ",", " ", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "pval"}], "]"}], " ", "<", " ", ".00101"}], "&"}], ",", " ", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", " ", RowBox[{"Show", "[", RowBox[{ RowBox[{"ListLinePlot", "[", RowBox[{"dataB", ",", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", "0.95"}], "}"}], ",", RowBox[{"{", RowBox[{"0.8", ",", "1.0"}], "}"}]}], "}"}]}], ",", RowBox[{"Frame", "->", "True"}], ",", " ", RowBox[{"FrameTicks", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}]}], "}"}]}], ",", " ", RowBox[{"RotateLabel", "->", "False"}], ",", RowBox[{"PlotStyle", "->", "Red"}], ",", RowBox[{"FrameLabel", "->", " ", RowBox[{"{", RowBox[{ "\"\\"", ",", " ", "\"\\""}], "}"}]}]}], "]"}], ",", " ", RowBox[{"Graphics", "[", RowBox[{"{", RowBox[{"Purple", ",", " ", RowBox[{"PointSize", "[", ".02", "]"}], ",", RowBox[{"Point", "[", "pShow", "]"}]}], "}"}], "]"}]}], "]"}]}], ","}], "*)"}], " ", " ", RowBox[{ RowBox[{"method", "==", "\"\\""}], " ", ",", " ", " ", " ", RowBox[{ RowBox[{"data", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"pp", ",", RowBox[{"coverageW", "[", RowBox[{"n", ",", "pp", ",", "\[Alpha]Val"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"pp", ",", "0.05", ",", ".5", ",", " ", ".001"}], "}"}]}], "]"}]}], ";", " ", RowBox[{"data", "=", RowBox[{"Join", "[", RowBox[{"data", ",", " ", RowBox[{ RowBox[{"Reverse", "@", "data"}], " ", "/.", " ", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", " ", "y_"}], "}"}], " ", ":>", " ", RowBox[{"{", RowBox[{ RowBox[{"1", "-", "x"}], ",", " ", "y"}], "}"}]}]}]}], "]"}]}], ";", " ", RowBox[{"pShow", "=", " ", RowBox[{ RowBox[{"Select", "[", RowBox[{"data", ",", " ", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "pval"}], "]"}], " ", "<", " ", ".00101"}], "&"}], ",", " ", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", " ", " ", RowBox[{"dataB", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"pp", ",", RowBox[{"coverageBones", "[", RowBox[{"n", ",", "pp", ",", "\[Alpha]Val"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"pp", ",", "0.05", ",", ".5", ",", " ", ".001"}], "}"}]}], "]"}]}], ";", " ", RowBox[{"dataB", "=", RowBox[{"Join", "[", RowBox[{"dataB", ",", " ", RowBox[{ RowBox[{"Reverse", "@", "dataB"}], " ", "/.", " ", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", " ", "y_"}], "}"}], " ", ":>", " ", RowBox[{"{", RowBox[{ RowBox[{"1", "-", "x"}], ",", " ", "y"}], "}"}]}]}]}], "]"}]}], ";", " ", RowBox[{"pShowB", "=", " ", RowBox[{ RowBox[{"Select", "[", RowBox[{"dataB", ",", " ", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "pval"}], "]"}], " ", "<", " ", ".00101"}], "&"}], ",", " ", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", " ", RowBox[{"GraphicsRow", "[", RowBox[{ RowBox[{"{", " ", RowBox[{ RowBox[{"ListLinePlot", "[", RowBox[{"data", ",", RowBox[{"PlotStyle", "->", "Blue"}], ",", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", "0.95"}], "}"}], ",", RowBox[{"{", RowBox[{"0.8", ",", "1.0"}], "}"}]}], "}"}]}], ",", RowBox[{"Frame", "->", "True"}], ",", " ", RowBox[{"FrameTicks", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}]}], "}"}]}], ",", " ", RowBox[{"RotateLabel", "->", "False"}], ",", RowBox[{"Axes", "->", "False"}], ",", RowBox[{"ImageSize", "->", "300"}], ",", RowBox[{"PlotLabel", "->", " ", RowBox[{"StringForm", "[", RowBox[{"\"\\"", ",", RowBox[{"NumberForm", "[", RowBox[{ RowBox[{"pShow", "[", RowBox[{"[", "2", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"4", ",", "3"}], "}"}]}], "]"}]}], "]"}]}], ",", "\n", " ", RowBox[{"FrameLabel", "->", " ", RowBox[{"{", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Italic"}], "]"}], ",", "\"\<, the population proportion\>\""}], "}"}], "]"}], ",", " ", RowBox[{ "\"\\"", ";", "\"\<\>\""}]}], "}"}]}], ",", " ", RowBox[{"Epilog", "->", " ", RowBox[{"{", RowBox[{"Purple", ",", " ", "Black", ",", " ", RowBox[{"PointSize", "[", ".025", "]"}], ",", RowBox[{"Point", "[", "pShow", "]"}]}], "}"}]}], ",", RowBox[{"GridLines", "->", RowBox[{"{", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{"{", RowBox[{"1", "-", "\[Alpha]Val"}], "}"}]}], "}"}]}]}], "]"}], ",", " ", RowBox[{"ListLinePlot", "[", RowBox[{"dataB", ",", RowBox[{"PlotStyle", "->", "Red"}], ",", RowBox[{"ImageSize", "->", "300"}], ",", RowBox[{"Frame", "->", "True"}], ",", " ", RowBox[{"PlotLabel", "->", " ", RowBox[{"StringForm", "[", RowBox[{"\"\\"", ",", RowBox[{"NumberForm", "[", RowBox[{ RowBox[{"pShowB", "[", RowBox[{"[", "2", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"4", ",", "3"}], "}"}]}], "]"}]}], "]"}]}], ",", " ", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", "0.95"}], "}"}], ",", RowBox[{"{", RowBox[{"0.8", ",", "1.0"}], "}"}]}], "}"}]}], ",", RowBox[{"FrameTicks", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}]}], "}"}]}], ",", " ", RowBox[{"Axes", "->", "False"}], ",", RowBox[{"FrameLabel", "->", " ", RowBox[{"{", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Italic"}], "]"}], ",", "\"\<, the population proportion\>\""}], "}"}], "]"}], ",", " ", RowBox[{ "\"\\"", ";", "\"\<\>\""}]}], "}"}]}], ",", " ", RowBox[{"GridLines", "->", RowBox[{"{", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{"{", RowBox[{"1", "-", "\[Alpha]Val"}], "}"}]}], "}"}]}], ",", RowBox[{"Epilog", "->", RowBox[{"{", RowBox[{"Black", ",", " ", RowBox[{"PointSize", "[", ".025", "]"}], ",", RowBox[{"Point", "[", "pShowB", "]"}]}], "}"}]}]}], "]"}]}], "}"}], ",", RowBox[{"Spacings", "->", RowBox[{"-", "20"}]}]}], "]"}]}], ",", " ", RowBox[{"method", "==", "\"\\""}], ",", " ", RowBox[{ RowBox[{"data", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"pp", ",", RowBox[{"coverageW", "[", RowBox[{"n", ",", "pp", ",", "\[Alpha]Val"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"pp", ",", "0.05", ",", ".5", ",", " ", ".001"}], "}"}]}], "]"}]}], ";", " ", RowBox[{"data", "=", RowBox[{"Join", "[", RowBox[{"data", ",", " ", RowBox[{ RowBox[{"Reverse", "@", "data"}], " ", "/.", " ", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", " ", "y_"}], "}"}], " ", ":>", " ", RowBox[{"{", RowBox[{ RowBox[{"1", "-", "x"}], ",", " ", "y"}], "}"}]}]}]}], "]"}]}], ";", " ", RowBox[{"pShow", "=", " ", RowBox[{ RowBox[{"Select", "[", RowBox[{"data", ",", " ", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "pval"}], "]"}], " ", "<", " ", ".00101"}], "&"}], ",", " ", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", " ", " ", RowBox[{"dataB", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"pp", ",", RowBox[{"coverageJeffreys", "[", RowBox[{"n", ",", "pp", ",", "\[Alpha]Val"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"pp", ",", "0.05", ",", ".5", ",", " ", ".001"}], "}"}]}], "]"}]}], ";", " ", RowBox[{"dataB", "=", RowBox[{"Join", "[", RowBox[{"dataB", ",", " ", RowBox[{ RowBox[{"Reverse", "@", "dataB"}], " ", "/.", " ", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", " ", "y_"}], "}"}], " ", ":>", " ", RowBox[{"{", RowBox[{ RowBox[{"1", "-", "x"}], ",", " ", "y"}], "}"}]}]}]}], "]"}]}], ";", " ", RowBox[{"pShowB", "=", " ", RowBox[{ RowBox[{"Select", "[", RowBox[{"dataB", ",", " ", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "pval"}], "]"}], " ", "<", " ", ".00101"}], "&"}], ",", " ", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", " ", RowBox[{"GraphicsRow", "[", RowBox[{ RowBox[{"{", " ", RowBox[{ RowBox[{"ListLinePlot", "[", RowBox[{"data", ",", RowBox[{"PlotStyle", "->", "Blue"}], ",", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", "0.95"}], "}"}], ",", RowBox[{"{", RowBox[{"0.8", ",", "1.0"}], "}"}]}], "}"}]}], ",", RowBox[{"Frame", "->", "True"}], ",", " ", RowBox[{"FrameTicks", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}]}], "}"}]}], ",", " ", RowBox[{"RotateLabel", "->", "False"}], ",", RowBox[{"ImageSize", "->", "300"}], ",", RowBox[{"PlotLabel", "->", " ", RowBox[{"StringForm", "[", RowBox[{"\"\\"", ",", RowBox[{"NumberForm", "[", RowBox[{ RowBox[{"pShow", "[", RowBox[{"[", "2", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"4", ",", "3"}], "}"}]}], "]"}]}], "]"}]}], ",", "\n", " ", RowBox[{"FrameLabel", "->", " ", RowBox[{"{", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Italic"}], "]"}], ",", "\"\<, the population proportion\>\""}], "}"}], "]"}], ",", " ", RowBox[{ "\"\\"", ";", "\"\<\>\""}]}], "}"}]}], ",", " ", RowBox[{"Axes", "->", "False"}], ",", RowBox[{"Epilog", "->", " ", RowBox[{"{", RowBox[{"Purple", ",", " ", "Black", ",", " ", RowBox[{"PointSize", "[", ".025", "]"}], ",", RowBox[{"Point", "[", "pShow", "]"}]}], "}"}]}], ",", RowBox[{"GridLines", "->", RowBox[{"{", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{"{", RowBox[{"1", "-", "\[Alpha]Val"}], "}"}]}], "}"}]}]}], "]"}], ",", " ", RowBox[{"ListLinePlot", "[", RowBox[{"dataB", ",", RowBox[{"PlotStyle", "->", "Red"}], ",", RowBox[{"ImageSize", "->", "300"}], ",", RowBox[{"Frame", "->", "True"}], ",", " ", RowBox[{"Axes", "->", "False"}], ",", RowBox[{"PlotLabel", "->", " ", RowBox[{"StringForm", "[", RowBox[{"\"\\"", ",", RowBox[{"NumberForm", "[", RowBox[{ RowBox[{"pShowB", "[", RowBox[{"[", "2", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"4", ",", "3"}], "}"}]}], "]"}]}], "]"}]}], ",", " ", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", "0.95"}], "}"}], ",", RowBox[{"{", RowBox[{"0.8", ",", "1.0"}], "}"}]}], "}"}]}], ",", RowBox[{"FrameTicks", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}]}], "}"}]}], ",", " ", RowBox[{"FrameLabel", "->", " ", RowBox[{"{", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Italic"}], "]"}], ",", "\"\<, the population proportion\>\""}], "}"}], "]"}], ",", " ", RowBox[{ "\"\\"", ";", "\"\<\>\""}]}], "}"}]}], ",", " ", RowBox[{"GridLines", "->", RowBox[{"{", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{"{", RowBox[{"1", "-", "\[Alpha]Val"}], "}"}]}], "}"}]}], ",", RowBox[{"Epilog", "->", RowBox[{"{", RowBox[{"Black", ",", " ", RowBox[{"PointSize", "[", ".025", "]"}], ",", RowBox[{"Point", "[", "pShowB", "]"}]}], "}"}]}]}], "]"}]}], "}"}], ",", RowBox[{"Spacings", "->", RowBox[{"-", "20"}]}]}], "]"}]}], ",", RowBox[{"method", "==", "\"\\""}], ",", " ", RowBox[{ RowBox[{"data", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"pp", ",", RowBox[{"coverageBones", "[", RowBox[{"n", ",", "pp", ",", "\[Alpha]Val"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"pp", ",", "0.05", ",", ".5", ",", " ", ".001"}], "}"}]}], "]"}]}], ";", " ", RowBox[{"data", "=", RowBox[{"Join", "[", RowBox[{"data", ",", " ", RowBox[{ RowBox[{"Reverse", "@", "data"}], " ", "/.", " ", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", " ", "y_"}], "}"}], " ", ":>", " ", RowBox[{"{", RowBox[{ RowBox[{"1", "-", "x"}], ",", " ", "y"}], "}"}]}]}]}], "]"}]}], ";", " ", RowBox[{"pShow", "=", " ", RowBox[{ RowBox[{"Select", "[", RowBox[{"data", ",", " ", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "pval"}], "]"}], " ", "<", " ", ".00101"}], "&"}], ",", " ", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", " ", " ", RowBox[{"dataB", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"pp", ",", RowBox[{"coverageJeffreys", "[", RowBox[{"n", ",", "pp", ",", "\[Alpha]Val"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"pp", ",", "0.05", ",", ".5", ",", " ", ".001"}], "}"}]}], "]"}]}], ";", " ", RowBox[{"dataB", "=", RowBox[{"Join", "[", RowBox[{"dataB", ",", " ", RowBox[{ RowBox[{"Reverse", "@", "dataB"}], " ", "/.", " ", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", " ", "y_"}], "}"}], " ", ":>", " ", RowBox[{"{", RowBox[{ RowBox[{"1", "-", "x"}], ",", " ", "y"}], "}"}]}]}]}], "]"}]}], ";", " ", RowBox[{"pShowB", "=", " ", RowBox[{ RowBox[{"Select", "[", RowBox[{"dataB", ",", " ", RowBox[{ RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "pval"}], "]"}], " ", "<", " ", ".00101"}], "&"}], ",", " ", "1"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", " ", RowBox[{"GraphicsRow", "[", RowBox[{ RowBox[{"{", " ", RowBox[{ RowBox[{"ListLinePlot", "[", RowBox[{"data", ",", RowBox[{"PlotStyle", "->", "Blue"}], ",", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", "0.95"}], "}"}], ",", RowBox[{"{", RowBox[{"0.8", ",", "1.0"}], "}"}]}], "}"}]}], ",", RowBox[{"Frame", "->", "True"}], ",", " ", RowBox[{"FrameTicks", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}]}], "}"}]}], ",", " ", RowBox[{"RotateLabel", "->", "False"}], ",", RowBox[{"ImageSize", "->", "300"}], ",", RowBox[{"PlotLabel", "->", " ", RowBox[{"StringForm", "[", RowBox[{"\"\\"", ",", RowBox[{"NumberForm", "[", RowBox[{ RowBox[{"pShow", "[", RowBox[{"[", "2", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"4", ",", "3"}], "}"}]}], "]"}]}], "]"}]}], ",", "\n", " ", RowBox[{"FrameLabel", "->", " ", RowBox[{"{", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Italic"}], "]"}], ",", "\"\<, the population proportion\>\""}], "}"}], "]"}], ",", " ", RowBox[{ "\"\\"", ";", "\"\<\>\""}]}], "}"}]}], ",", " ", RowBox[{"Epilog", "->", " ", RowBox[{"{", RowBox[{"Purple", ",", " ", "Black", ",", " ", RowBox[{"PointSize", "[", ".025", "]"}], ",", RowBox[{"Point", "[", "pShow", "]"}]}], "}"}]}], ",", RowBox[{"GridLines", "->", RowBox[{"{", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{"{", RowBox[{"1", "-", "\[Alpha]Val"}], "}"}]}], "}"}]}], ",", " ", RowBox[{"Axes", "->", "False"}]}], "]"}], ",", " ", RowBox[{"ListLinePlot", "[", RowBox[{"dataB", ",", RowBox[{"PlotStyle", "->", "Red"}], ",", RowBox[{"ImageSize", "->", "300"}], ",", RowBox[{"Frame", "->", "True"}], ",", " ", RowBox[{"PlotLabel", "->", " ", RowBox[{"StringForm", "[", RowBox[{"\"\\"", ",", RowBox[{"NumberForm", "[", RowBox[{ RowBox[{"pShowB", "[", RowBox[{"[", "2", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"4", ",", "3"}], "}"}]}], "]"}]}], "]"}]}], ",", " ", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.05", ",", "0.95"}], "}"}], ",", RowBox[{"{", RowBox[{"0.8", ",", "1.0"}], "}"}]}], "}"}]}], ",", RowBox[{"FrameTicks", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"Automatic", ",", " ", RowBox[{"{", "}"}]}], "}"}]}], "}"}]}], ",", " ", RowBox[{"FrameLabel", "->", " ", RowBox[{"{", RowBox[{ RowBox[{"Row", "[", RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{"\"\\"", ",", "Italic"}], "]"}], ",", "\"\<, the population proportion\>\""}], "}"}], "]"}], ",", " ", RowBox[{ "\"\\"", ";", "\"\<\>\""}]}], "}"}]}], ",", " ", RowBox[{"GridLines", "->", RowBox[{"{", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{"{", RowBox[{"1", "-", "\[Alpha]Val"}], "}"}]}], "}"}]}], ",", RowBox[{"Axes", "->", "False"}], ",", RowBox[{"Epilog", "->", RowBox[{"{", RowBox[{"Black", ",", " ", RowBox[{"PointSize", "[", ".025", "]"}], ",", RowBox[{"Point", "[", "pShowB", "]"}]}], "}"}]}]}], "]"}]}], "}"}], ",", RowBox[{"Spacings", "->", RowBox[{"-", "20"}]}]}], "]"}]}]}], "]"}]}], ",", " ", " ", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"n", ",", "30", ",", " ", "\"\\""}], "}"}], ",", " ", "15", ",", " ", "100", ",", " ", "1", ",", RowBox[{"Appearance", "->", "\"\\""}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ "\[Alpha]Valbar", ",", "0.95", ",", " ", "\"\\""}], "}"}], ",", " ", ".85", ",", " ", ".99", ",", " ", RowBox[{"Appearance", "->", "\"\\""}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"pval", ",", ".4", ",", " ", RowBox[{"Row", "[", RowBox[{"{", RowBox[{"\"\\"", ",", " ", RowBox[{"Style", "[", RowBox[{"\"\\"", ",", " ", "Italic"}], "]"}]}], "}"}], "]"}]}], "}"}], ",", " ", ".05", ",", " ", ".95", ",", " ", RowBox[{"Appearance", "->", "\"\\""}]}], "}"}], ",", " ", RowBox[{"(*", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"method", ",", "\"\\""}], "}"}], ",", " ", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}], "}"}], ","}], "*)"}], " ", RowBox[{"{", RowBox[{ RowBox[{"{", " ", RowBox[{"method", ",", "\"\\""}], "}"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{ "\"\\"", "->", "\"\\""}], ",", RowBox[{ "\"\\"", "->", "\"\\""}], ",", RowBox[{ "\"\\"", "->", "\"\\""}]}], "}"}]}], "}"}], ",", " ", " ", " ", RowBox[{"TrackedSymbols", "->", "True"}], ",", " ", RowBox[{"Initialization", ":>", " ", RowBox[{"(", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"coverageW", "[", RowBox[{"n_", ",", " ", "p_", ",", " ", "\[Alpha]_"}], "]"}], " ", ":=", " ", RowBox[{"With", "[", RowBox[{ RowBox[{"{", RowBox[{"q", "=", FractionBox[ RowBox[{"2", " ", SuperscriptBox[ RowBox[{"InverseErfc", "[", RowBox[{"2", "-", "\[Alpha]"}], "]"}], "2"]}], "n"]}], "}"}], ",", RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"x", "=", "1"}], RowBox[{"n", "-", "1"}]], RowBox[{"If", "[", RowBox[{ RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"n", " ", "p"}], "-", "x"}], ")"}], "2"], "<=", RowBox[{"q", " ", "x", " ", RowBox[{"(", RowBox[{"n", "-", "x"}], ")"}]}]}], ",", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", "p"}], ")"}], RowBox[{"n", "-", "x"}]], " ", SuperscriptBox["p", "x"], " ", RowBox[{"Binomial", "[", RowBox[{"n", ",", "x"}], "]"}]}], ",", "0"}], "]"}]}]}], "]"}]}], ")"}], ";", " ", RowBox[{ RowBox[{"coverageBones", "[", RowBox[{"n_", ",", " ", "p_", ",", " ", "\[Alpha]_"}], "]"}], " ", ":=", " ", RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"x", "=", "0"}], "n"], RowBox[{"If", "[", RowBox[{ RowBox[{"\[Alpha]", "<=", RowBox[{"2", " ", RowBox[{"BetaRegularized", "[", RowBox[{"p", ",", RowBox[{"x", "+", "1"}], ",", RowBox[{"2.", "+", "n", "-", RowBox[{"(", RowBox[{"x", "+", "1"}], ")"}]}]}], "]"}]}], "<=", RowBox[{"2", "-", "\[Alpha]"}]}], ",", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", "p"}], ")"}], RowBox[{"n", "-", "x"}]], " ", SuperscriptBox["p", "x"], " ", RowBox[{"Binomial", "[", RowBox[{"n", ",", "x"}], "]"}]}], ",", "0"}], "]"}]}]}], ";", " ", RowBox[{ RowBox[{"coverageJeffreys", "[", RowBox[{"n_", ",", " ", "p_", ",", " ", "\[Alpha]_"}], "]"}], " ", ":=", " ", RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"x", "=", "0"}], "n"], RowBox[{"If", "[", RowBox[{ RowBox[{"\[Alpha]", "<=", RowBox[{"2", " ", RowBox[{"BetaRegularized", "[", RowBox[{"p", ",", RowBox[{"x", "+", RowBox[{"1", "/", "2"}]}], ",", RowBox[{"2.", "+", "n", "-", RowBox[{"(", RowBox[{"x", "+", RowBox[{"1", "/", "2"}]}], ")"}]}]}], "]"}]}], "<=", RowBox[{"2", "-", "\[Alpha]"}]}], ",", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", "p"}], ")"}], RowBox[{"n", "-", "x"}]], " ", SuperscriptBox["p", "x"], " ", RowBox[{"Binomial", "[", RowBox[{"n", ",", "x"}], "]"}]}], ",", "0"}], "]"}]}]}]}], ")"}]}]}], "]"}]], "Input", CellGroupingRules->{"GroupTogetherGrouping", 10000.}, CellChangeTimes->{{3.5272622145621977`*^9, 3.5272622196742983`*^9}, { 3.527283627382959*^9, 3.527283637175366*^9}, { 3.5272843535352697`*^9, 3.527284422766177*^9}, { 3.5273275556737223`*^9, 3.5273276565267878`*^9}, { 3.527327869456354*^9, 3.527327891615947*^9}, {3.527338210809993*^9, 3.527338322667094*^9}, {3.527338357301359*^9, 3.527338454120364*^9}, {3.527346206621819*^9, 3.527346289669503*^9}, {3.527507382284278*^9, 3.527507435550672*^9}, {3.5275076532961817`*^9, 3.527507830592732*^9}, {3.5275078867276773`*^9, 3.527507889562131*^9}, {3.5275080066049557`*^9, 3.527508155671091*^9}, {3.5275081879356747`*^9, 3.527508212735955*^9}, {3.5275082434815493`*^9, 3.527508359199999*^9}, {3.5275090117574253`*^9, 3.527509090623837*^9}, {3.5275091768493223`*^9, 3.527509232619052*^9}, {3.52750926560284*^9, 3.527509273501916*^9}, {3.527509319781776*^9, 3.52750941609128*^9}, {3.5275104271407948`*^9, 3.5275104759620657`*^9}, {3.5275186481913424`*^9, 3.527518651254923*^9}, {3.527520011649496*^9, 3.527520012595716*^9}, {3.52752641198892*^9, 3.527526509921767*^9}, {3.527526571001597*^9, 3.527526843720739*^9}, {3.527526878691223*^9, 3.527527001821413*^9}, {3.5275294964878674`*^9, 3.527529668213957*^9}, {3.5275297745840693`*^9, 3.5275297753501368`*^9}, {3.5275307954873543`*^9, 3.527530882700614*^9}, {3.527604636221746*^9, 3.527604683519259*^9}, {3.5276047916253433`*^9, 3.527604798339003*^9}, {3.527604957125887*^9, 3.5276049817709017`*^9}, {3.527682227802706*^9, 3.527682481544129*^9}, {3.5276825618724117`*^9, 3.527682564289633*^9}, {3.527769561615143*^9, 3.527769665708466*^9}, {3.5277697562170887`*^9, 3.527770138402566*^9}, {3.527770172375597*^9, 3.527770234398232*^9}, {3.527770280449884*^9, 3.5277703374738398`*^9}, {3.527770438057621*^9, 3.527770490098009*^9}, {3.527770522897997*^9, 3.52777052315362*^9}, 3.527770766083873*^9, {3.527787513156848*^9, 3.527787770371242*^9}, {3.527788143176672*^9, 3.527788171617028*^9}, {3.528131938720489*^9, 3.528131955878605*^9}, {3.528131996632607*^9, 3.528132016838871*^9}, {3.5281320548464937`*^9, 3.5281320592709427`*^9}, {3.5281321481595182`*^9, 3.5281321535054493`*^9}, {3.528132208060349*^9, 3.5281322175076323`*^9}, {3.5281382864160023`*^9, 3.528138288215315*^9}, {3.5281383345577517`*^9, 3.528138488983499*^9}, {3.528138639099428*^9, 3.528138640122878*^9}, {3.528836359585223*^9, 3.528836359979945*^9}, {3.528836476596855*^9, 3.528836636942782*^9}, {3.528836688728758*^9, 3.528836771619738*^9}, {3.528836801641246*^9, 3.528836841193479*^9}, {3.52883687551226*^9, 3.52883715351898*^9}, {3.528837292611637*^9, 3.5288373045235357`*^9}, {3.559402020596078*^9, 3.559402020829108*^9}, {3.55964993027831*^9, 3.5596500123242598`*^9}, {3.559650544952322*^9, 3.559650642039852*^9}, 3.5599091874887323`*^9, { 3.5599095147178464`*^9, 3.5599095560808463`*^9}, { 3.5599096342618465`*^9, 3.55990971540232*^9}, 3.7608407026628733`*^9}, CellID->1856455635], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`method$$ = "WaldAndBayesian", $CellContext`n$$ = 30, $CellContext`pval$$ = 0.4, $CellContext`\[Alpha]Valbar$$ = 0.95, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`n$$], 30, "sample size"}, 15, 100, 1}, {{ Hold[$CellContext`\[Alpha]Valbar$$], 0.95, "confidence level, 1-\[Alpha]"}, 0.85, 0.99}, {{ Hold[$CellContext`pval$$], 0.4, Row[{"population proportion, ", Style["p", Italic]}]}, 0.05, 0.95}, {{ Hold[$CellContext`method$$], "WaldAndBayesian"}, { "WaldAndBayesian" -> "Wald & Bayesian", "WaldAndJeffreys" -> "Wald & Jeffreys", "BayesianAndJeffreys" -> "Bayesian & Jeffreys"}}}, Typeset`size$$ = { 572., {101., 106.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = False, $CellContext`n$74809$$ = 0, $CellContext`\[Alpha]Valbar$74810$$ = 0, $CellContext`pval$74811$$ = 0, $CellContext`method$74812$$ = False}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`method$$ = "WaldAndBayesian", $CellContext`n$$ = 30, $CellContext`pval$$ = 0.4, $CellContext`\[Alpha]Valbar$$ = 0.95}, "ControllerVariables" :> { Hold[$CellContext`n$$, $CellContext`n$74809$$, 0], Hold[$CellContext`\[Alpha]Valbar$$, \ $CellContext`\[Alpha]Valbar$74810$$, 0], Hold[$CellContext`pval$$, $CellContext`pval$74811$$, 0], Hold[$CellContext`method$$, $CellContext`method$74812$$, False]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> ($CellContext`\[Alpha]Val = 1 - $CellContext`\[Alpha]Valbar$$; Which[$CellContext`method$$ == "WaldAndBayesian", $CellContext`data = Table[{$CellContext`pp, $CellContext`coverageW[$CellContext`n$$, \ $CellContext`pp, $CellContext`\[Alpha]Val]}, {$CellContext`pp, 0.05, 0.5, 0.001}]; $CellContext`data = Join[$CellContext`data, ReplaceAll[ Reverse[$CellContext`data], { Pattern[$CellContext`x, Blank[]], Pattern[$CellContext`y, Blank[]]} :> { 1 - $CellContext`x, $CellContext`y}]]; \ $CellContext`pShow = Part[ Select[$CellContext`data, Abs[Part[#, 1] - $CellContext`pval$$] < 0.00101& , 1], 1]; $CellContext`dataB = Table[{$CellContext`pp, $CellContext`coverageBones[$CellContext`n$$, \ $CellContext`pp, $CellContext`\[Alpha]Val]}, {$CellContext`pp, 0.05, 0.5, 0.001}]; $CellContext`dataB = Join[$CellContext`dataB, ReplaceAll[ Reverse[$CellContext`dataB], { Pattern[$CellContext`x, Blank[]], Pattern[$CellContext`y, Blank[]]} :> { 1 - $CellContext`x, $CellContext`y}]]; \ $CellContext`pShowB = Part[ Select[$CellContext`dataB, Abs[Part[#, 1] - $CellContext`pval$$] < 0.00101& , 1], 1]; GraphicsRow[{ ListLinePlot[$CellContext`data, PlotStyle -> Blue, PlotRange -> {{0.05, 0.95}, {0.8, 1.}}, Frame -> True, FrameTicks -> {{Automatic, {}}, {Automatic, {}}}, RotateLabel -> False, Axes -> False, ImageSize -> 300, PlotLabel -> StringForm["Wald coverage, ``", NumberForm[ Part[$CellContext`pShow, 2], {4, 3}]], FrameLabel -> { Row[{ Style["p", Italic], ", the population proportion"}], "coverage Wald (blue)\nand Bones (red)"; ""}, Epilog -> {Purple, Black, PointSize[0.025], Point[$CellContext`pShow]}, GridLines -> {{}, {1 - $CellContext`\[Alpha]Val}}], ListLinePlot[$CellContext`dataB, PlotStyle -> Red, ImageSize -> 300, Frame -> True, PlotLabel -> StringForm["Bayesian coverage, ``", NumberForm[ Part[$CellContext`pShowB, 2], {4, 3}]], PlotRange -> {{0.05, 0.95}, {0.8, 1.}}, FrameTicks -> {{Automatic, {}}, {Automatic, {}}}, Axes -> False, FrameLabel -> { Row[{ Style["p", Italic], ", the population proportion"}], "coverage Wald (blue)\nand Bones (red)"; ""}, GridLines -> {{}, {1 - $CellContext`\[Alpha]Val}}, Epilog -> {Black, PointSize[0.025], Point[$CellContext`pShowB]}]}, Spacings -> -20], $CellContext`method$$ == "WaldAndJeffreys", $CellContext`data = Table[{$CellContext`pp, $CellContext`coverageW[$CellContext`n$$, \ $CellContext`pp, $CellContext`\[Alpha]Val]}, {$CellContext`pp, 0.05, 0.5, 0.001}]; $CellContext`data = Join[$CellContext`data, ReplaceAll[ Reverse[$CellContext`data], { Pattern[$CellContext`x, Blank[]], Pattern[$CellContext`y, Blank[]]} :> { 1 - $CellContext`x, $CellContext`y}]]; \ $CellContext`pShow = Part[ Select[$CellContext`data, Abs[Part[#, 1] - $CellContext`pval$$] < 0.00101& , 1], 1]; $CellContext`dataB = Table[{$CellContext`pp, $CellContext`coverageJeffreys[$CellContext`n$$, \ $CellContext`pp, $CellContext`\[Alpha]Val]}, {$CellContext`pp, 0.05, 0.5, 0.001}]; $CellContext`dataB = Join[$CellContext`dataB, ReplaceAll[ Reverse[$CellContext`dataB], { Pattern[$CellContext`x, Blank[]], Pattern[$CellContext`y, Blank[]]} :> { 1 - $CellContext`x, $CellContext`y}]]; \ $CellContext`pShowB = Part[ Select[$CellContext`dataB, Abs[Part[#, 1] - $CellContext`pval$$] < 0.00101& , 1], 1]; GraphicsRow[{ ListLinePlot[$CellContext`data, PlotStyle -> Blue, PlotRange -> {{0.05, 0.95}, {0.8, 1.}}, Frame -> True, FrameTicks -> {{Automatic, {}}, {Automatic, {}}}, RotateLabel -> False, ImageSize -> 300, PlotLabel -> StringForm["Wald coverage, ``", NumberForm[ Part[$CellContext`pShow, 2], {4, 3}]], FrameLabel -> { Row[{ Style["p", Italic], ", the population proportion"}], "coverage Wald (blue)\nand Jeffreys (red)"; ""}, Axes -> False, Epilog -> {Purple, Black, PointSize[0.025], Point[$CellContext`pShow]}, GridLines -> {{}, {1 - $CellContext`\[Alpha]Val}}], ListLinePlot[$CellContext`dataB, PlotStyle -> Red, ImageSize -> 300, Frame -> True, Axes -> False, PlotLabel -> StringForm["Jeffreys coverage, ``", NumberForm[ Part[$CellContext`pShowB, 2], {4, 3}]], PlotRange -> {{0.05, 0.95}, {0.8, 1.}}, FrameTicks -> {{Automatic, {}}, {Automatic, {}}}, FrameLabel -> { Row[{ Style["p", Italic], ", the population proportion"}], "coverage Wald (blue)\nand Bones (red)"; ""}, GridLines -> {{}, {1 - $CellContext`\[Alpha]Val}}, Epilog -> {Black, PointSize[0.025], Point[$CellContext`pShowB]}]}, Spacings -> -20], $CellContext`method$$ == "BayesianAndJeffreys", $CellContext`data = Table[{$CellContext`pp, $CellContext`coverageBones[$CellContext`n$$, \ $CellContext`pp, $CellContext`\[Alpha]Val]}, {$CellContext`pp, 0.05, 0.5, 0.001}]; $CellContext`data = Join[$CellContext`data, ReplaceAll[ Reverse[$CellContext`data], { Pattern[$CellContext`x, Blank[]], Pattern[$CellContext`y, Blank[]]} :> { 1 - $CellContext`x, $CellContext`y}]]; \ $CellContext`pShow = Part[ Select[$CellContext`data, Abs[Part[#, 1] - $CellContext`pval$$] < 0.00101& , 1], 1]; $CellContext`dataB = Table[{$CellContext`pp, $CellContext`coverageJeffreys[$CellContext`n$$, \ $CellContext`pp, $CellContext`\[Alpha]Val]}, {$CellContext`pp, 0.05, 0.5, 0.001}]; $CellContext`dataB = Join[$CellContext`dataB, ReplaceAll[ Reverse[$CellContext`dataB], { Pattern[$CellContext`x, Blank[]], Pattern[$CellContext`y, Blank[]]} :> { 1 - $CellContext`x, $CellContext`y}]]; \ $CellContext`pShowB = Part[ Select[$CellContext`dataB, Abs[Part[#, 1] - $CellContext`pval$$] < 0.00101& , 1], 1]; GraphicsRow[{ ListLinePlot[$CellContext`data, PlotStyle -> Blue, PlotRange -> {{0.05, 0.95}, {0.8, 1.}}, Frame -> True, FrameTicks -> {{Automatic, {}}, {Automatic, {}}}, RotateLabel -> False, ImageSize -> 300, PlotLabel -> StringForm["Bayesian coverage, ``", NumberForm[ Part[$CellContext`pShow, 2], {4, 3}]], FrameLabel -> { Row[{ Style["p", Italic], ", the population proportion"}], "coverage Wald (blue)\nand Bones (red)"; ""}, Epilog -> {Purple, Black, PointSize[0.025], Point[$CellContext`pShow]}, GridLines -> {{}, {1 - $CellContext`\[Alpha]Val}}, Axes -> False], ListLinePlot[$CellContext`dataB, PlotStyle -> Red, ImageSize -> 300, Frame -> True, PlotLabel -> StringForm["Jeffreys coverage, ``", NumberForm[ Part[$CellContext`pShowB, 2], {4, 3}]], PlotRange -> {{0.05, 0.95}, {0.8, 1.}}, FrameTicks -> {{Automatic, {}}, {Automatic, {}}}, FrameLabel -> { Row[{ Style["p", Italic], ", the population proportion"}], "coverage Wald (blue)\nand Bones (red)"; ""}, GridLines -> {{}, {1 - $CellContext`\[Alpha]Val}}, Axes -> False, Epilog -> {Black, PointSize[0.025], Point[$CellContext`pShowB]}]}, Spacings -> -20]]), "Specifications" :> {{{$CellContext`n$$, 30, "sample size"}, 15, 100, 1, Appearance -> "Labeled"}, {{$CellContext`\[Alpha]Valbar$$, 0.95, "confidence level, 1-\[Alpha]"}, 0.85, 0.99, Appearance -> "Labeled"}, {{$CellContext`pval$$, 0.4, Row[{"population proportion, ", Style["p", Italic]}]}, 0.05, 0.95, Appearance -> "Labeled"}, {{$CellContext`method$$, "WaldAndBayesian"}, { "WaldAndBayesian" -> "Wald & Bayesian", "WaldAndJeffreys" -> "Wald & Jeffreys", "BayesianAndJeffreys" -> "Bayesian & Jeffreys"}}}, "Options" :> {TrackedSymbols -> True}, "DefaultOptions" :> {ControllerLinking -> True}], ImageSizeCache->{617., {187., 193.}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, Initialization:>(($CellContext`coverageW[ Pattern[$CellContext`n, Blank[]], Pattern[$CellContext`p, Blank[]], Pattern[$CellContext`\[Alpha], Blank[]]] := With[{$CellContext`q = 2 (InverseErfc[ 2 - $CellContext`\[Alpha]]^2/$CellContext`n)}, Sum[ If[($CellContext`n $CellContext`p - $CellContext`x)^2 <= \ ($CellContext`q $CellContext`x) ($CellContext`n - $CellContext`x), (( 1 - $CellContext`p)^($CellContext`n - $CellContext`x) \ $CellContext`p^$CellContext`x) Binomial[$CellContext`n, $CellContext`x], 0], {$CellContext`x, 1, $CellContext`n - 1}]]; $CellContext`coverageBones[ Pattern[$CellContext`n, Blank[]], Pattern[$CellContext`p, Blank[]], Pattern[$CellContext`\[Alpha], Blank[]]] := Sum[ If[$CellContext`\[Alpha] <= 2 BetaRegularized[$CellContext`p, $CellContext`x + 1, 2. + $CellContext`n - ($CellContext`x + 1)] <= 2 - $CellContext`\[Alpha], (( 1 - $CellContext`p)^($CellContext`n - $CellContext`x) \ $CellContext`p^$CellContext`x) Binomial[$CellContext`n, $CellContext`x], 0], {$CellContext`x, 0, $CellContext`n}]; $CellContext`coverageJeffreys[ Pattern[$CellContext`n, Blank[]], Pattern[$CellContext`p, Blank[]], Pattern[$CellContext`\[Alpha], Blank[]]] := Sum[ If[$CellContext`\[Alpha] <= 2 BetaRegularized[$CellContext`p, $CellContext`x + 1/2, 2. + $CellContext`n - ($CellContext`x + 1/2)] <= 2 - $CellContext`\[Alpha], (( 1 - $CellContext`p)^($CellContext`n - $CellContext`x) \ $CellContext`p^$CellContext`x) Binomial[$CellContext`n, $CellContext`x], 0], {$CellContext`x, 0, $CellContext`n}]); Typeset`initDone$$ = True), SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellGroupingRules->{"GroupTogetherGrouping", 10000.}, CellChangeTimes->{3.559938078560123*^9, 3.5599381223105497`*^9, 3.7608407026632643`*^9}, CellID->1943802834] }, {2}]]