0
$\begingroup$

I'm struggling with the following problem:

I have a range of numbers (i.e. ages from 5 to 95) and for every of those ages I have a probability (i.e. the probability that a given input has this age).

Let's take an example with ages = [10,11,12,13,14,15] probs = [0.01,0.15,0.68,0.12,0.02,0.02]

I can easily calculate the "expected" age by multiplying the number range with the probabilities.

exp_age = 12.05

However, I want a measure of uncertainty, i.e. the standard deviation of the possible ages.

One way to achieve it is to "construct" a number of 100 observations where for each age, the age occurs 100*its probability. In our above case, that would be 1*10,15*11,68*12,... I can than compute the standard deviation of those observations to get a measure for the uncertainty.

However, with many possible ages this can get quite slow and I am wondering whether there exists a direct numerical solution to my problem.

$\endgroup$
2
  • $\begingroup$ Okay, I think I found a proper solution myself: calculate $z = (ages-age_{expected})^2$ then $stdev = \sqrt{\sum{probs * z}}$ $\endgroup$
    – Zahlii
    Feb 6, 2018 at 10:27
  • 1
    $\begingroup$ Yes, this is pretty much how the standard deviation is defined. If you think this answers your question, post it as an answer and accept it, so that others can easily find this information and the question is marked as resolved. $\endgroup$ Feb 6, 2018 at 11:40

1 Answer 1

0
$\begingroup$

Okay, I think I found a prober solution myself:

First, calculate

$z = (ages-age_{expected})^2$

Then $stdev = \sqrt{\sum{probs * z}}$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.