Probability | Inequalities | Markov and Chebyshev


Question

Question: Suppose we know that the number of items produced in a factory during a week is a random variable with mean 500

  1. What can be said about the probability that this week’s production will be at least 1000? (Answer = 0.5)
  2. If the variance of a week’s production is known to equal 83333.3, then what can be said about the probability that this week’s production will be between 400 and 600? (Answer = 1)

*You can scroll through the table to find the answers


Solution Part 1

The solution for the first part can be obtained from Markov’s Inequality. To quickly refresh our understanding of this inequality let us see the definition \[P \{ X \ge a \} \le \frac{E[X]}{a} \] where the random variable \(X\) can only take non-negative values Note: Markov’s Inequality gives an upper bound on the probability. Also note that for some values of a less than the expected value, you get a probability upper bound to be greater than 1. From the definitions of the probability though, since the greater than 1 are nonsensical.\(^\dagger\)

Simulation: The table below is a calculation and a simulation shown next to each other. The column in Red is the inequality we are interested in. The column in orange is the upper bound defined by Markov’s Inequality. The column in the Blue is the calculated probability from the simulation. The parameters of the simulation are defined as follows. The random variable is Randomly Distributed from 0 to 1000, which means that the expected value is 500.

\(\dagger\) In order to remove the nonsensical values, I have used the Clip function in Mathematica for restricting the upper limit to 1. Hence you do not see the orange values to be greater than 1.


Module[{markovString, probabilities},
 markovString[list_List] :=
  stringJoinStyled[{Style[
     "P {a \[GreaterEqual] " <>
      StringPadRight[ToString[list[[1]]] <> "}", 5], Red],
    " \[LessEqual] ",
    Style[StringPadRight[ToString[list[[2]]], 10], Orange],
    Style[" : p from simulation = ", Darker@Green],
    Style[ToString[list[[3]]], Blue]}];

 probabilities =
  Table[Module[{sampleSize = 10000, data, probs,
     expectation =
      Expectation[r, r \[Distributed] UniformDistribution[{0, 1000}]]},
    data = RandomReal[{0, 1000}, 10000];
    probs =
     N /@ {x, Clip[expectation/x, {0, 1}],
       Length[Select[data, # >= x &]]/sampleSize}],
   {x, 25, 1975, 25}];

 Export[StringReplace[NotebookFileName[], ".nb" -> "_part01.svg"],
  TableForm[markovString /@ probabilities], ImageResolution -> 800,
  ImageSize -> 400]
 ]

Solution Part 2

For this part, we will be using another inequality expression called Chebyshev’s Inequality. Given that \(k \ge 0\) \[P\{|X – \mu| \ge k \} ≤ \frac{\sigma^2}{k^2}\] The clipping has been done applied for this inequality as we have done in the previous section. The column in Red is the inequality we are interested in. The column in orange is the upper bound defined by Chebyshev’s Inequality. The column in the Blue is the calculated probability from the simulation. The parameters of the simulation are defined as follows. The random variable is Randomly Distributed from 0 to 1000, which means that the expected value (\(\mu\)) is 500 and the variance \((\sigma^2)\) is 83333.3.



Module[{chebyshevString, probabilities},
 chebyshevString[list_List] := stringJoinStyled[{Style["P{|x - \!\(\*
StyleBox[\"\[Mu]\",\nFontWeight->\"Bold\"]\)| \[GreaterEqual] " <>
      StringPadRight[ToString[list[[1]]], 3], Red],
    "} \[LessEqual] ",
    Style[StringPadRight[ToString[list[[2]]], 10], Orange],
    Style[" : p from simulation = ", Darker@Green],
    Style[ToString[list[[3]]], Blue]}];

 probabilities =
  Table[Module[{sampleSize = 10000, data, probs, expectation = 500,
     variance = 1000^2/12},
    data = RandomReal[{0, 1000}, 10000];
    probs =
     N /@ {x, Clip[variance/x^2, {0, 1}],
       Length[Select[data, Abs[# - 500] >= x &]]/sampleSize}],
   {x, 25, 975, 10}];
 Export[StringReplace[NotebookFileName[], ".nb" -> "_part02.svg"],
  TableForm[chebyshevString /@ probabilities], ImageResolution -> 800,
   ImageSize -> 430]

 ]