Author: 藍邦偉  老師

更換主題

顯示:母體資料

每次樣本數:n=

取樣次數:

信賴區間

p = 0.63 (slider from 0 to 1, step 0.01)
a: floor(1000 * p)
list2 = Shuffle(Join[{Sequence[1 + p * 0, t, 1, a], Sequence[0 + p * 0, t, 1, 1024 - a]}])
n = 25 (slider from 1 to 100, step 1)
m = 30 (slider from 1 to 100, step 1)
k = 0 (slider from 0 to m + 1, step 1)
list1 = Sequence(1024)
s = 0.9 (slider from 0 to 1, step 0.1)
list12 = Sequence(Sample[list1, n + s * 0], t, 1, m)
list13 = Sequence(Sequence[Element[list2, Element[Element[list12, i], j]], j, 1, n], i, 1, m)
list14 = Sequence(Sum[Element[list13, i] / n], i, 1, m)
list15 = Sequence(sqrt(Element[list14, i] * (1 - Element[list14, i]) / n), i, 1, m)
d: 10 / m / 4
list3 = Sequence(BoxPlot[4 * d * t, d, Element[list14, t] - 2 * Element[list15, t], Element[list14, t] - Element[list15, t], Element[list14, t], Element[list14, t] + Element[list15, t], Element[list14, t] + 2 * Element[list15, t]], t, 1, k - 1)
b = BoxPlot(4 * d * k, d, Element[list14, k] - 2 * Element[list15, k], Element[list14, k] - Element[list15, k], Element[list14, k], Element[list14, k] + Element[list15, k], Element[list14, k] + 2 * Element[list15, k])
list5 = Element(list12, k)
list6 = Element(list13, k)
e = false
inputBox1 = Textfield(n)
inputBox2 = Textfield(m)
list9 = Sequence((t, 0), t, 0, 1, 0.1)
list11 = Sequence(Text[t, (t - 0.02, -0.5)], t, 0, 1, 0.1)
f = Segment((0, 0), (1.1, 0))
g = Segment((0, 0), (0, 10.5))
list10 = Sequence(Segment[(t, 0), (t, 10.5)], t, 0.1, 1, 0.1)
c = Segment((p, 0), (p, 10.5))
text4 = Text("p=" + p, (p, 10.6))
list4 = Sequence(Text[If[Element[list2, i] ≟ 1, "o", "x"], (-1.1 + Mod[i - 1, 32] / 35, floor((i - 1) / 32) / 3)], i, 1, 1024)
list8 = Sequence(Text["*", (-1.1 + Mod[i - 1, 32] / 35, floor((i - 1) / 32) / 3 - 0.15)], i, 1, 1024)
h = Sum(Sequence[If[(p - Element[list14, t] - 2 * Element[list15, t]) * (p - Element[list14, t] + 2 * Element[list15, t]) ≤ 0, 1, 0], t, 1, m])
list7 = Sequence(Text[If[Element[list6, i] ≟ 1, "o", "x"], (-1.1 + Mod[Element[list5, i] - 1, 32] / 35, floor((Element[list5, i] - 1) / 32) / 3)], i, 1, n)
list16 = RemoveUndefined(Sequence[If[(p - Element[list14, t] - 2 * Element[list15, t]) * (p - Element[list14, t] + 2 * Element[list15, t]) > 0, t], t, 1, m])
list17 = Sequence(BoxPlot[4 * d * Element[list16, s], d, Element[list14, Element[list16, s]] - 2 * Element[list15, Element[list16, s]], Element[list14, Element[list16, s]] - Element[list15, Element[list16, s]], Element[list14, Element[list16, s]], Element[list14, Element[list16, s]] + Element[list15, Element[list16, s]], Element[list14, Element[list16, s]] + 2 * Element[list15, Element[list16, s]]], s, 1, Length[list16])
text2: "$\fgcolor{blue}{母體真正平均值p=" + (LaTeX[p]) + "}$
$每次樣本數\bgcolor{yellow}{" + (LaTeX[n]) + "}個,共取樣\bgcolor{yellow}{" + (LaTeX[m]) + "}次的調查中,有\bgcolor{yellow}{" + (LaTeX[h]) + "}次$
$(\bgcolor{yellow}{大約" + (LaTeX[floor(h / m * 1000) / 10]) + "\%})的區間包含\fgcolor{blue}{母體真正的平均值p}$"
text1: "$\bgcolor{yellow}{第" + (LaTeX[k]) + "次}取樣之樣本資料:$
$樣本編號:" + (LaTeX[Element[list12, k]]) + "$
$樣本態度:" + (LaTeX[Element[list13, k]]) + "$
$\bgcolor{yellow}{" + (LaTeX[n]) + "個樣本中有" + (LaTeX[Sum[Element[list13, k]]]) + "個同意⇒\hat p=" + (LaTeX[Element[list14, k]]) + ",\hat \sigma=\sqrt{\frac{\hat p(1-\hat p)}{n}}=" + (LaTeX[Element[list15, k]]) + "}$"