Skip to content

Missing values

layerbn provides three options for empty cells. You can set the option for all variables or for each variable separately.

Option Effect Use when
error (default) The check stops and lists the number of missing values per variable. You want to choose an option for each variable explicitly.
category Empty cells become a separate state, Missing, which is modelled like any other value. No participants are excluded. Missingness may be informative, for example a test that was not performed because the participant was too ill, a questionnaire that was not returned, or a measurement that was skipped for a clinical reason.
drop_rows Participants without a value for this variable are excluded. Few values are missing, for reasons unrelated to the study, such as a lost form or a device failure.

Alternatively, you can impute the missing values in your own software before the analysis.

Setting the option

In settings.yml:

data:
  missing: category

In variables.xlsx, on the variables sheet, use the missing column (a dropdown list). If a cell is empty, the setting in settings.yml is used.

variable layer missing
AGE Background
SMOKING Lifestyle drop_rows
SCORE_A Clinical category
SCORE_B Clinical category
EVENT Outcome

In this example, participants without a smoking status are excluded. Missing values of score A and score B are modelled as Missing. A missing value for age or the outcome stops the check with a message.

Display

A variable with missing values modelled as a category has one additional state. It is shown last, with a grey bar and an italic label. For a continuous variable, the groups are based on the observed values, and Missing is added after them.

A network with Missing states

The example data with missing values in Exposure B (8%) and Measure 3 (15%). Measure 3 is missing more often in participants with the outcome. The arc from Measure 3 to the outcome includes this difference between measured and missing values.

Missing is treated as a regular state in all results:

  • In the report, the bins table lists Missing after the groups, and the run reports the number of missing values per variable.
  • In a profile or sweep, Missing can be used as a value. For example, SCORE_A: Missing gives the probability of the outcome for participants without a measurement of score A.
  • In the explorer, Missing can be selected as evidence.

Interpretation

Arcs that involve a Missing state

An arc to or from a variable with a Missing state can reflect the missingness, the measured values, or both. Check the distributions in the figure or the explorer. If the outcome differs mainly between measured and missing, the association concerns which participants were measured, not the measured value. Report it as such.

  • category makes no assumption about why values are missing. The network shows whether missingness is associated with other variables.
  • A Missing state with few participants (for example, fewer than 20) is estimated with low precision, as is any small group. Consider drop_rows for that variable.
  • With drop_rows, the remaining participants can differ from the excluded participants. The run reports the number of excluded participants. Include this number in the publication.

Back to the six steps