Estimating time I have some data about a number of projects that have been categorized. For each project, I have the proportion of the total project length that was spent on testing. For each category, I have to estimate how long testing would likely take for any project of that category. I was wondering how best to solve this.
I would sincerely appreciate any suggestion.
 A: The Bayesian approach is a very simple way to proceed. For simplicity, let's work with a fixed category and analyze the data from a fixed category via the conjugate beta-binomial model. In order to fit into this framework, we need to discretize the sample space. So, pick a suitably large number $N$, that represents the number of stages (of equal length of calendar time) each projects undergoes. Define $X$ to be the number of stages that a given project spends in testing. Then $X\sim binomial(N, \theta)$, where the unknown parameter $\theta$ is the object of our study. We may use the non-informative (flat) prior $\theta\sim Beta(1,1)$, which is the uniform distribution on [0,1]. More generally, let $\theta\sim Beta(a,b)$ be the prior distribution of parameter $\theta$.
Because beta-binomial is a conjugate family, the posterior distribution has a very simple closed form. If we have data on $M$ projects (in the fixed category), and each project takes $X_j$ stages for testing, with $j=1,...,M$, then the posterior distribution is
$$
\pi(\theta) = Beta(a + \sum_{j=1}^M X_j, b+ MN-\sum_{j=1}^M X_j).
$$
Given posterior $\pi(\theta)$ it is an easy exercise to compute the desired probability that a project in the given category spends $k$ stages (or fraction $k/N$ of time) in testing
$$
Pr[X=k] = E\{1\{X=k\} \} \\
= E[ E\{1\{X=k\} | \theta \}] = E_{\pi}[ \binom{N}{k} \theta^k (1-\theta)^{N-k}] 
$$
where the outer expectation is over random variable $\theta$ with distribution $\pi(\theta)$. After integrating out $\theta$ we obtain closed form (upto the Gamma function) expression:
$$
Pr[X=k] = \binom{N}{k}\frac{\Gamma(a+b)\Gamma(a+\sum X_j +k)\Gamma(b+MN-\sum X_j + N-k)}{\Gamma(a)\Gamma(b)\Gamma(a+b+MN+ N)}.
$$
