# Calculate mean from cumulative percentage table

Is it possible to calculate mean from cumulative percentage table below?

Scenario: Bob is a manager. He is trying to estimate the sales for the next year, and from his experience, he knows the sales should go like the table below. Now, he would like to know what's the mean of the sales.

Thank you!

Sales | Possibility that sales below this number
100 0%
105 5.00%
110 10.00%
116 15.00%
122 20.00%
128 25.00%
134 35.00%
141 45.00%
148 55.00%
155 65.00%
163 75.00%
171 90.00%
200 100%

• Is this an exercise question (you have tagged self-study) - if so, you need to explain what you understand / have tried. Nov 23, 2017 at 8:08
• This is a question I have in my job. It's not from a textbook. I have edited the question. Thanks.
– cht
Nov 23, 2017 at 8:38
• Currently it is not possible to give a single value. (1) the percentage is below a single value and above a different single value, so you need to decide what to do with this range. (2) there is no upper limit (below 100%). The mean is susceptible to outliers, so the value below 100% could influence the final result by a lot. Nov 23, 2017 at 9:14
• @YuvalSpiegler is it possible to give a range with confidence interval or other things? I think I learned it before but it was long time ago... Any hints would be very helpful. Thanks.
– cht
Nov 23, 2017 at 10:20
• The answer is (very) sensitive to the upper percentiles. Suppose in Bob's experience there is a 1/20 chance of 10,000 sales: the expected sales next year would then be above 650. If, on the other hand, he knows it's impossible for sales to exceed 200, then the expected sales cannot differ much from 150. This analysis has nothing to do with confidence intervals or other things. Once you pin down the upper limit, you can apply Shepard's correction.
– whuber
Nov 23, 2017 at 14:21

I understand this question is about two years old, but it was recently poked by Community and so came to my attention. I'd solve this problem using the relationship between a survival function of a non-negative random variable and its expectation. Let $$X$$ be a non-negative random variable (here $$X$$ is total sales). Then $$EX = \int_0^\infty (1-F(x))\ dx$$, where $$F(x) = P(X \leq x)$$ denotes the cumulative distribution function (CDF) of $$X$$. From the data you have, we can see that $$P(100 \leq X \leq 200) = 1$$ (implying $$X$$ is non-negative). So, we have \begin{aligned} EX &= \int_{0}^{\infty} (1-F(x)) \ dx \\ &= \int_{0}^{200} (1-F(x)) \ dx \qquad \text{(since } 1 - F(x) = P(X > x) = 0 \text{ for } x \geq 200) \\ &= (200 - 0) - \int_{100}^{200} F(x) \ dx \\ &= 200 - \left[\int_{100}^{105} F(x) \ dx + \int_{105}^{110} F(x) \ dx + \dots + \int_{171}^{200} F(x) \ dx \right] \end{aligned}

Since we don't know the CDF completely, all we can do is some approximation. A simple (albeit crude) approximation is given by the composite trapezoidal method. Here we approximate each of the above sub-integrals using the Trapezoidal rule, which says that the definite integral $$\int_{a}^{b} F(x) \, dx \approx (b-a) \cdot \frac{F(a)+F(b)}{2}.$$ So, e.g., $$\int_{100}^{105} F(x) \ dx \approx (105 - 100) [F(100) + F(105)]/2 = 5 * (0 + 0.05)/2 = 0.125$$. An R implementation of this approximation scheme is as follows:

x <- c(100, 105, 110, 116, 122, 128, 134,
141, 148, 155, 163, 171, 200)
Fx <- c(0, 0.05, 0.10, 0.15, 0.20, 0.25, 0.35,
0.45, 0.55, 0.65, 0.75, 0.90, 1)
n <- length(Fx)
EX.approx <- 200 - sum(diff(x) * (Fx[-n] + Fx[-1])/2)
EX.approx
#  144.3


Another approximation will be obtained by first linearly interpolating $$F$$ in $$[100, 200]$$ based on the data we have, and then doing a numerical integration over that interpolated function. Here is an R implementation based on this interpolation approach:

Fx_smooth <- approxfun(x = x, y = Fx, method = "linear")
EX.approx2 <- 200 - integrate(Fx_smooth,
lower = 100,
upper = 200)\$val
EX.approx2
#  144.2997


Edits: Grammar.

So, given a probability distribution p(x), the mean is the integral of x*p(x) over the relevant domain (i.e. where p(x) is non-zero). What you have there isn't a probability distribution, though, it's an integrated probability distribution (which I'll call "h(x)" in this post) evaluated at a finite set of points. So what we know, for example, is the integral of p(x) from -inf to 100 is 0, the integral of p(x) from 100 to 105 is 5%, the integral of p(x) from 100 to 110 is 10%, etc. If we were given the function h(x) that gave all of these percentage values, for every x, then we can in fact recover p(x) by taking the derivative of h(x). With h(x) evaluated at only a finite set of points, there is no way to reconstruct p(x), and therefore no way to obtain the mean.

At best, you can give an approximation of the mean, by making a few additional assumptions. For example, you can assume the probability distribution p(x) consists of segments of horizontal lines (a collection of uniform distributions over the domain). In this, case you split your domain up into 12 segments, you take the midpoint of the segment and multiply it by the probability in that segment (this is performing the integral for a bunch of horizontal lines). So concretely you would do:

102.5*5%+107.5*5%+113*5%+... and get an estimate that way. But this is just a guess at the mean, depending on how the probability distribution is actually shaped in between each interval, the mean could change.