Skip to Content
BayesiaLabKey ConceptsMeans and Values of Nodes

Means and Values of Nodes

Context

At the top of each Monitor, the fields Mean, Dev, and Value can be displayed.

Loading SVG...

Mean refers to the Mean Value mm and is only shown in the Monitors of numerical nodes.

Dev displays the standard deviation alongside Mean.

Value displays the expected value vv and is available for both categorical and numerical nodes.

Examples

The calculations for Expected Value and Mean Value are shown in the context of the following examples:

Categorical node

In this example, Age\mathit{Age} is a discrete node with three categorical states.

  • Child\mathrm{Child}
  • Adult\mathrm{Adult}
  • Senior\mathrm{Senior}

Categorical node with assigned state values

In the Node Editor, you can assign State Values to the states of Age\mathit{Age}.

Node Editor showing State Values assignment
Loading SVG...

For each node, the Expected Value vv is computed using the assigned State Values and the marginal probability distribution of the Node States:

v=∑s∈Sps×Vsv = \sum_{s \in S} p_s \times V_s

where psp_s is the marginal probability of state ss and VsV_s is its associated value.

v=0.23×10+0.415×40+0.355×70=43.750v = 0.23 \times 10 + 0.415 \times 40 + 0.355 \times 70 = 43.750

The Monitor shows vv as the Value of Age\mathit{Age}.

A Monitor of a categorical node does not show a Mean value.

Discrete numerical variable

Let’s suppose that the node Age\mathit{Age} has three numerical Node States instead of categorical Node States.

Node Editor with discrete numerical states for the Age node

In this context, we need to consider two conditions, with and without State Values specified in the Node Editor:

No state values specified

Here, State Values are not specified in the Values tab of the Node Editor. Note the empty Value column below.

NoStateValues

As a result, BayesiaLab uses the numerical values of the Node States, as they appear in the States tab, as the State Values.

Furthermore, as Age\mathit{Age} is a numerical node, its Monitor will now display the Mean and Dev in addition to Value.

Loading SVG...

The mean mm is computed using the numerical values of the Node States and the marginal probability distribution of the Node States:

m=∑s∈Sps×csm = \sum_{s \in S} p_s \times c_s

where csc_s is the numerical value of the Node State.

m=0.23×10+0.415×40+0.355×70=43.750m = 0.23 \times 10 + 0.415 \times 40 + 0.355 \times 70 = 43.750

Note that Mean and Value are identical in this case.

State values specified

However, if State Values are separately specified in the Values tab of the Node Editor, they will be used for the calculation of Value in the Monitor.

To illustrate the distinction, we assign the states 10\mathrm{10}, 40\mathrm{40}, and 70\mathrm{70} the values 0, 1, and 2, respectively.

StateValuesDefined
Loading SVG...

The Expected Value vv is computed now using the assigned State Values 0, 1, and 2 and the marginal probability distribution of the Node States:

v=∑s∈Sps×Vsv = \sum_{s \in S} p_s \times V_s

where psp_s is the marginal probability of state ss and VsV_s is its associated value.

v=0.23×0+0.415×1+0.355×2=1.125v = 0.23 \times 0 + 0.415 \times 1 + 0.355 \times 2 = 1.125

The Monitor shows vv as the Value of Age\mathit{Age}.

Note that Mean and Value are not identical in this case.

Loading SVG...

Mean weights the ages 10, 40, and 70 by their probabilities. Value applies the same weights to the assigned scores 0, 1, and 2.

Continuous numerical variable

In the next example, Age\mathit{Age} is a continuous node with domain [0,99][0,99] and three discretized states.

  • Child\mathrm{Child}: [0,18][0,18]
  • Adult\mathrm{Adult}: (18,65](18,65]
  • Senior\mathrm{Senior}: (65,99](65,99]
Node Editor states for a continuous node

Given that Age\mathit{Age} is a numerical node, its Monitor shows the fields Mean, Dev, and Value.

Loading SVG...

No associated data

When no data is associated with the node, both csc_s and VsV_s use the midpoint of each state’s interval. For Adult\mathrm{Adult}, the midpoint of (18,65](18,65] is 41.541.5. At probability 0.4150.415, this state contributes 0.415×41.5=17.22250.415 \times 41.5 = 17.2225 to each weighted sum below.

So, the Mean Value mm is computed as follows:

m=∑s∈Sps×csm = \sum_{s \in S} p_s \times c_sm=0.23×9+0.415×41.5+0.355×82=48.4025m = 0.23 \times 9 + 0.415 \times 41.5 + 0.355 \times 82 = 48.4025

The Expected Value vv is calculated analogously:

v=∑s∈Sps×Vsv = \sum_{s \in S} p_s \times V_sv=0.23×9+0.415×41.5+0.355×82=48.4025v = 0.23 \times 9 + 0.415 \times 41.5 + 0.355 \times 82 = 48.4025
Loading SVG...

With no associated data or custom state values, BayesiaLab uses each interval midpoint for both Mean and Value. The dots mark the ages used in the weighted sum.

Associated data

If data is associated with the node, csc_s is defined as the arithmetic mean of the data points that are associated with each Node State.

Furthermore, clicking on the Generate Values button in the Node Editor sets the values VsV_s to the current arithmetic means of each Node State.

Generate Values button in the Node Editor

Value delta

If you set a new piece of evidence on a node that modifies the distribution of the node, the Monitor displays a delta value in parentheses adjacent to Value.

Loading SVG...

This delta is the difference between the current Expected Value vv and:

  • the Expected Value vv before setting the modifying evidence, or
  • the Expected Value vv that corresponds to the Reference Probability Distribution, which you can set with the icon in the toolbar.

Special case: some node states without values

If only some Node States have an associated value, the Expected Value vv is computed from the subset of Node States S∗S^* that do have an associated value.

v=∑s∈S∗psP∗×Vsv = \sum_{s \in S^*} \frac{p_s}{P^*} \times V_s

Here, P∗=∑s∈S∗psP^*=\sum_{s\in S^*}p_s is the total probability of the states with assigned values.

Loading SVG...

Suppose only Adult and Senior have assigned values, 40 and 70. Together they carry 77% of the probability. Dividing each probability by 0.77 gives the weights used to calculate Value.

If a node only has a single Node State with an associated value, the corresponding Monitor does not report the Expected Value vv.