第864行: |
第864行: |
| <font color="#ff8000">Wald 法</font> | | <font color="#ff8000">Wald 法</font> |
| | | |
− | : <math> \widehat{p\,} \pm z \sqrt{ \frac{ \widehat{p\,} ( 1 -\widehat{p\,} )}{ n } } .</math> | + | :<math> \widehat{p\,} \pm z \sqrt{ \frac{ \widehat{p\,} ( 1 -\widehat{p\,} )}{ n } } .</math> |
| | | |
− | <math>\frac{}\widehat{p\,} + \frac{z^2}{2n} + z</math> | + | <math>\frac{p}{z^2}{2n}\widehat{p\,} + \frac{z^2}{2n} + z</math> |
| | | |
| : A [[continuity correction]] of 0.5/''n'' may be added. {{clarify|date=July 2012}}; | | : A [[continuity correction]] of 0.5/''n'' may be added. {{clarify|date=July 2012}}; |
第872行: |
第872行: |
| 可以添加一个0.5/''n''连续调整。(2012年7月更新) | | 可以添加一个0.5/''n''连续调整。(2012年7月更新) |
| | | |
− | <math> \sqrt{\frac{\widehat{p\,}(1 - \widehat{p\,})}{n} </math> | + | <math> \sqrt{\frac{p}{n}\widehat{p\,}(1 - \widehat{p\,}){n} </math> |
| | | |
| ==== Agresti–Coull method ==== | | ==== Agresti–Coull method ==== |
第963行: |
第963行: |
| | | |
| <math> &= \sum_{k=m}^n \binom{n}{k} \binom{k}{m} p^k q^m (1-p)^{n-k} (1-q)^{k-m}</math> | | <math> &= \sum_{k=m}^n \binom{n}{k} \binom{k}{m} p^k q^m (1-p)^{n-k} (1-q)^{k-m}</math> |
− |
| |
− | \sqrt{}
| |
− |
| |
− | <math> \end{align}</math>
| |
| | | |
| <math>\frac{\widehat{p\,}(1 - \widehat{p\,})}{n} </math> | | <math>\frac{\widehat{p\,}(1 - \widehat{p\,})}{n} </math> |
第974行: |
第970行: |
| 由于<math>\tbinom{n}{k} \tbinom{k}{m} = \tbinom{n}{m} \tbinom{n-m}{k-m}</math>,上述方程可表示为 | | 由于<math>\tbinom{n}{k} \tbinom{k}{m} = \tbinom{n}{m} \tbinom{n-m}{k-m}</math>,上述方程可表示为 |
| | | |
− | <math> \frac{z^2}{4 n^2}</math> | + | <math>\frac{z^2}{4 n^2}</math> |
| | | |
| <math> \Pr[Y = m] = \sum_{k=m}^{n} \binom{n}{m} \binom{n-m}{k-m} p^k q^m (1-p)^{n-k} (1-q)^{k-m} </math> | | <math> \Pr[Y = m] = \sum_{k=m}^{n} \binom{n}{m} \binom{n-m}{k-m} p^k q^m (1-p)^{n-k} (1-q)^{k-m} </math> |
第983行: |
第979行: |
| | | |
| }{ | | }{ |
− |
| |
− | <math>\begin{align}</math>
| |
| | | |
| <math> 1 + \frac{z^2}{n}</math> | | <math> 1 + \frac{z^2}{n}</math> |
| | | |
− | <math> \Pr[Y = m] &= \binom{n}{m} p^m q^m \left( \sum_{k=m}^n \binom{n-m}{k-m} p^{k-m} (1-p)^{n-k} (1-q)^{k-m} \right) \\[2pt]}</math><ref>{{cite book | + | <math>\Pr[Y = m] &= \binom{n}{m} p^m q^m \left( \sum_{k=m}^n \binom{n-m}{k-m} p^{k-m} (1-p)^{n-k} (1-q)^{k-m} \right) \\[2pt]}</math><ref>{{cite book |
| | | |
| <math> &= \binom{n}{m} (pq)^m \left( \sum_{k=m}^n \binom{n-m}{k-m} \left(p(1-q)\right)^{k-m} (1-p)^{n-k} \right)</math> | | <math> &= \binom{n}{m} (pq)^m \left( \sum_{k=m}^n \binom{n-m}{k-m} \left(p(1-q)\right)^{k-m} (1-p)^{n-k} \right)</math> |
第1,017行: |
第1,011行: |
| }}</ref> | | }}</ref> |
| | | |
− | <math> &= \binom{n}{m} (pq)^m (1-pq)^{n-m}</math> | + | <math> &= \binom{n}{m} (pq)^m (1-pq)^{n-m}</math> |
| | | |
| ==== Comparison ==== | | ==== Comparison ==== |
第1,023行: |
第1,017行: |
| and thus Y \sim B(n, pq) as desired. | | and thus Y \sim B(n, pq) as desired. |
| | | |
− | 因此Y \sim B(n, pq)为所需值。
| + | 因此<math>Y \sim B(n, pq)</math>为所需值。 |
| | | |
| The exact ([[Binomial proportion confidence interval#Clopper–Pearson interval|Clopper–Pearson]]) method is the most conservative.<ref name="Brown2001" /> | | The exact ([[Binomial proportion confidence interval#Clopper–Pearson interval|Clopper–Pearson]]) method is the most conservative.<ref name="Brown2001" /> |
第1,058行: |
第1,052行: |
| | | |
| | | |
− | | + | <math>\operatorname P(Z=k) &= \sum_{i=0}^k\left[\binom{n}i p^i (1-p)^{n-i}\right]\left[\binom{m}{k-i} p^{k-i} (1-p)^{m-k+i}\right]\\</math> |
− | | |
− | :<math>\operatorname P(Z=k) &= \sum_{i=0}^k\left[\binom{n}i p^i (1-p)^{n-i}\right]\left[\binom{m}{k-i} p^{k-i} (1-p)^{m-k+i}\right]\\</math>
| |
| | | |
| Binomial [[probability mass function and normal probability density function approximation for n = 6 and p = 0.5]] | | Binomial [[probability mass function and normal probability density function approximation for n = 6 and p = 0.5]] |
第1,066行: |
第1,058行: |
| 二项式n = 6 and p = 0.5的概率质量函数和正态概率密度函数近似 | | 二项式n = 6 and p = 0.5的概率质量函数和正态概率密度函数近似 |
| | | |
− | <math> &= \binom{n+m}k p^k (1-p)^{n+m-k}</math>
| + | <math> &= \binom{n+m}k p^k (1-p)^{n+m-k}</math> |
| | | |
| | | |
第1,153行: |
第1,145行: |
| :<math>\Pr[Y = m] &= \sum_{k = m}^{n} \Pr[Y = m \mid X = k] \Pr[X = k] \\[2pt]</math> | | :<math>\Pr[Y = m] &= \sum_{k = m}^{n} \Pr[Y = m \mid X = k] \Pr[X = k] \\[2pt]</math> |
| | | |
− | <math>P(p;\alpha,\beta) = \frac{p^{\alpha-1}(1-p)^{\beta-1}}{\mathrm{B}(\alpha,\beta)}.</math> | + | <math>P(p;\alpha,\beta) =\frac{p^{\alpha-1}(1-p)^{\beta-1}}{\mathrm{B}(\alpha,\beta)}.</math> |
| | | |
− | <math>P (p; alpha,beta) = frac { p ^ { alpha-1}(1-p) ^ { beta-1}{ mathrm { b }(alpha,beta)}}. | + | <math>P (p; alpha,beta) = frac { p ^ { alpha-1}(1-p) ^ { beta-1}{ mathrm { b }(alpha,beta)}}.</math> |
| | | |
− | &= \sum_{k=m}^n \binom{n}{k} \binom{k}{m} p^k q^m (1-p)^{n-k} (1-q)^{k-m}</math>
| + | <math> &= \sum_{k=m}^n \binom{n}{k} \binom{k}{m} p^k q^m (1-p)^{n-k} (1-q)^{k-m}</math></math> |
| | | |
| Given a uniform prior, the posterior distribution for the probability of success given independent events with observed successes is a beta distribution. | | Given a uniform prior, the posterior distribution for the probability of success given independent events with observed successes is a beta distribution. |
第1,178行: |
第1,170行: |
| <font color="#ff8000">边缘分布 marginal distribution </font>是二项分布较完善的随机数产生方法。 | | <font color="#ff8000">边缘分布 marginal distribution </font>是二项分布较完善的随机数产生方法。 |
| | | |
− | :<math>\Pr[Y = m] &= \binom{n}{m} p^m q^m \left( \sum_{k=m}^n \binom{n-m}{k-m} p^{k-m} (1-p)^{n-k} (1-q)^{k-m} \right) \\[2pt]</math>
| + | <math>\Pr[Y = m] &= \binom{n}{m} p^m q^m \left( \sum_{k=m}^n \binom{n-m}{k-m} p^{k-m} (1-p)^{n-k} (1-q)^{k-m} \right) \\[2pt]</math> |
| | | |
| One way to generate random samples from a binomial distribution is to use an inversion algorithm. To do so, one must calculate the probability that for all values from through . (These probabilities should sum to a value close to one, in order to encompass the entire sample space.) Then by using a pseudorandom number generator to generate samples uniformly between 0 and 1, one can transform the calculated samples into discrete numbers by using the probabilities calculated in the first step. | | One way to generate random samples from a binomial distribution is to use an inversion algorithm. To do so, one must calculate the probability that for all values from through . (These probabilities should sum to a value close to one, in order to encompass the entire sample space.) Then by using a pseudorandom number generator to generate samples uniformly between 0 and 1, one can transform the calculated samples into discrete numbers by using the probabilities calculated in the first step. |
| | | |
| 一种从二项分布中产生随机样本的方法是使用<font color="#ff8000">反演算法 inversion algorithm </font>。要做到这一点,我们必须计算从到的所有值的概率。(为了包含整个样本空间,这些概率的和应该接近于1。)然后,通过使用伪随机数生成器来生成介于0和1之间的样本,可以使用在第一步计算出的概率将计算出的样本转换成离散数。 | | 一种从二项分布中产生随机样本的方法是使用<font color="#ff8000">反演算法 inversion algorithm </font>。要做到这一点,我们必须计算从到的所有值的概率。(为了包含整个样本空间,这些概率的和应该接近于1。)然后,通过使用伪随机数生成器来生成介于0和1之间的样本,可以使用在第一步计算出的概率将计算出的样本转换成离散数。 |
− | | + | :<math>&= \binom{n}{m} (pq)^m \left( \sum_{k=m}^n \binom{n-m}{k-m} \left(p(1-q)\right)^{k-m} (1-p)^{n-k} \right)</math> |
− | &= \binom{n}{m} (pq)^m \left( \sum_{k=m}^n \binom{n-m}{k-m} \left(p(1-q)\right)^{k-m} (1-p)^{n-k} \right)
| |
− | | |
− | \end{align}</math>
| |
| | | |
| After substituting <math> i = k - m </math> in the expression above, we get | | After substituting <math> i = k - m </math> in the expression above, we get |