Condtional expected value formula that satify the general case when there is no condtion

26 Views Asked by At

Let (X) be a random variable, and let (B) be an event. Let $X_B$ be the set of values of (X) that correspond to the event (B), and let (n(B)) be the count of events where the event (B) is satisfied. The conditional expected value formula using the count of events is as follows

$E(X|B) = \frac{\sum_{i=1}^k x_i \cdot n_i}{n(B)}$

where:

  • $x_i$ represents the (i)-th distinct value in (X_B).
  • $n_i$ is the count or frequency of the $i$th distinct value in $X_B$.
  • $n(B) = n_1 + n_2 + \ldots + n_k$ is the total count of events in $X_B$.
    where $k$ is the number of distinct values in $X_B$

Now if there is no condition, this is just E(X) and one should divibde by the total count. Is there a way to modify the above equation such that when one plugs it in ( with or without condition) it covers both cases ? I cant think of a way of writing that using the count of events as above. The cases can be easily covered with the conditional portability formula:
$E(X|B)=\sum_X xP(X|B)$
but I cant generalize the equation $E(X|B) = \frac{\sum_{i=1}^k x_i \cdot n_i}{n(B)}$ in a way that covers condition or no condition cases.
Edit : I am assuming the sample space is finite and the random variables are discrete