# What is the distribution of the Binomial distribution parameter $p$ given a sample k and n?

If I have a $k$ successes in $n$ bernoulli trials, does the parameter $p$ of the binomial distribution follow a well-known distribution? There are some methods to calculate confidence intervals for $p$, I'm interested in the distribution for the exact method.

-
I think you mean the sample proportion $\hat{p}=k/n$. –  Rob Hyndman Jul 19 '11 at 2:37

From a bayesian point of view the distribution of p with k empirical successes and n trials is the Beta-Distribution, in detail $p\sim Beta(\alpha,\beta)$ with $\alpha=k+1$ and $\beta=n-k+1$. It represents the unnormalized density $prob(p|data)$, i.e. the unormalized probability that the unknown parameter is $p$ given the data (successes and trials) you have seen so far.

Edit: Let n be arbitrary but fixed. Then the posterior density can be derived via Bayes theorem $prob(p|k)=\frac{prob(k|p)*prob(p)}{prob(k)}\propto prob(k|p)\propto p^k(1-p)^{n-k}$. A uniform prior $prob(p)$ is assumed here, the normalizing constant $prob(k)$ is skipped since it does not depend on p. Hence "unnormalized". The distribution of $prob(p|k)$ given a fixed n (i.e. $prob(p|k,n)$) is the Betadistribution as specified above.

For example: The r-package binom uses the Betadistribution for calculating confidence intervals. See the methods biom.confint i.e. binom.bayes

-
Good answer. I'm wondering what is "unnormalized" about the Beta distribution? Perhaps you're thinking of $p^\alpha(1-p)^\beta dp$ instead? –  whuber Jul 19 '11 at 13:57
That's it! Is there a way to normalize it? –  Penz Jul 20 '11 at 0:40
@whuber I updated my answer, I was thinking of the "derivation". –  steffen Jul 20 '11 at 7:11
@Penz In general there is no need for manual normalization, e.g. for determination of confidence intervals you can use the already available inverse-cdf-functions like "qbeta" in R. –  steffen Jul 20 '11 at 7:11
The sample proportion $\hat{p}=k/n$ has a scaled Binomial distribution. That is $k\sim\text{Binomial}(n,p)$ which is scaled by the sample size $n$. I don't think it has any other name.
The text passage discusses the distribution of the parameter \( p \) of a Binomial distribution given a sample of \( k \) successes in \( n \) Bernoulli trials. It mentions the Beta distribution as the posterior distribution for \( p \) from a Bayesian perspective and discusses the use of the Beta distribution for calculating confidence intervals.
no_question

the passage does not contain a direct mathematical question that requires a specific answer. instead, it provides a discussion and explanation of the distribution of \( p \) and methods for calculating confidence intervals.
Given a text passage, determine:
    1. If it contains a mathematical question (including word problems or calculations)
    2. If an answer to that mathematical question is provided in the text

First, describe the content structure you found in 1-2 sentences.

Then provide your analysis in the following format:
TYPE: <one of the following values>
- NO_QUESTION
- SINGLE_QUESTION
- SINGLE_QUESTION_WITH_ANSWER
- MULTIPLE_QUESTIONS
- MULTIPLE_QUESTIONS_WITH_ANSWERS
system
# What is the distribution of the Binomial distribution parameter $p$ given a sample k and n?

If I have a $k$ successes in $n$ bernoulli trials, does the parameter $p$ of the binomial distribution follow a well-known distribution? There are some methods to calculate confidence intervals for $p$, I'm interested in the distribution for the exact method.

-
I think you mean the sample proportion $\hat{p}=k/n$. –  Rob Hyndman Jul 19 '11 at 2:37

From a bayesian point of view the distribution of p with k empirical successes and n trials is the Beta-Distribution, in detail $p\sim Beta(\alpha,\beta)$ with $\alpha=k+1$ and $\beta=n-k+1$. It represents the unnormalized density $prob(p|data)$, i.e. the unormalized probability that the unknown parameter is $p$ given the data (successes and trials) you have seen so far.

Edit: Let n be arbitrary but fixed. Then the posterior density can be derived via Bayes theorem $prob(p|k)=\frac{prob(k|p)*prob(p)}{prob(k)}\propto prob(k|p)\propto p^k(1-p)^{n-k}$. A uniform prior $prob(p)$ is assumed here, the normalizing constant $prob(k)$ is skipped since it does not depend on p. Hence "unnormalized". The distribution of $prob(p|k)$ given a fixed n (i.e. $prob(p|k,n)$) is the Betadistribution as specified above.

For example: The r-package binom uses the Betadistribution for calculating confidence intervals. See the methods biom.confint i.e. binom.bayes

-
Good answer. I'm wondering what is "unnormalized" about the Beta distribution? Perhaps you're thinking of $p^\alpha(1-p)^\beta dp$ instead? –  whuber Jul 19 '11 at 13:57
That's it! Is there a way to normalize it? –  Penz Jul 20 '11 at 0:40
@whuber I updated my answer, I was thinking of the "derivation". –  steffen Jul 20 '11 at 7:11
@Penz In general there is no need for manual normalization, e.g. for determination of confidence intervals you can use the already available inverse-cdf-functions like "qbeta" in R. –  steffen Jul 20 '11 at 7:11
The sample proportion $\hat{p}=k/n$ has a scaled Binomial distribution. That is $k\sim\text{Binomial}(n,p)$ which is scaled by the sample size $n$. I don't think it has any other name.
user
The text passage discusses the distribution of the parameter \( p \) of a Binomial distribution given a sample of \( k \) successes in \( n \) Bernoulli trials. It mentions the Beta distribution as the posterior distribution for \( p \) from a Bayesian perspective and discusses the use of the Beta distribution for calculating confidence intervals.

TYPE: NO_QUESTION

The passage does not contain a direct mathematical question that requires a specific answer. Instead, it provides a discussion and explanation of the distribution of \( p \) and methods for calculating confidence intervals.