##### Child pages
• Means and Values of Nodes

# Question

How does BayesiaLab calculate the Means and Values in the Monitors? What is the difference?

For each node that has values associated with its states, an Expected Value $v$ is computed by using the associated values and the marginal probability distribution of the node $$v = \sum_{s \in S} p_s \times V_s$$ where $p_s$ is the marginal probability of state $s$ and $V_s$ is its associated value.

This Expected Value is displayed in the monitor.

Example

Let's take a discrete node Age with three categorical states:

• Senior

The Node Editor allows associating numerical values with these states.  $$v = 0.23 \times 25 + 0.415 \times 45 + 0.355 \times 80 = 52.825$$

Let's suppose now that the variable Age has three numerical states. As it's a numerical node, its monitor will have a Mean value, a Standard Deviation and an Expected Value. When the states do not have any associated values, $V_s$ is automatically set to the numerical value of the state.

Otherwise, the state values defined by the user are used:  The Mean value $m$ is computed with the following equation: $$m = \sum_{s \in S} p_s \times c_s$$ where $c_s$ is the numerical value of the state.

Let's consider now a continuous variable Age defined on the domain [15 ; 99],  discretized into three states:

• Young Adult: [15 ; 30]
• Senior: ]60 ; 99] Since it's a numerical node, its monitor has a Mean value, a Standard Deviation and an Expected Value as well. The Mean value $m$ is computed with the following equation: $$m = \sum_{s \in S} p_s \times c_s$$ where $c_s$ is the central tendency of the state defined as:
• the mid-range of the state when no data is associated,
• the arithmetic mean of the data points that are associated with the state.
When the states do not have any associated values, $V_s$ is automatically set to the central tendency of the state.
When a dataset is associated with a continuous variable, clicking on the Generate Values buttons sets the values $V_s$ to the current arithmetic means. When new pieces of evidence are set, a the delta value is displayed in the monitor: This delta is the difference between the current Expected Value v

and:

• the previous one,
• the one corresponding to the reference probability distribution set with in the toolbar.
When only some states have an associated value, the Expected Value is computed on the states $S^*$ that have associated values $$v = \sum_{s \in S^*} \frac{p_s}{P^*} \times V_s$$ where $S^*$ is only made of one state, the node is considered as not having any associated values.