Documentation

13.3 Processing order: mutate, filter, and analysis

The order is fixed: select the input file, apply --mutate or [data].mutate, read the mutated file, apply the general filter and observation filter, classify records/covariates, derive EDA columns, then build plots and tables. Changing this order would change the population and therefore the result.

Mutate and filter execution order

General and observation filters

--filter EXPR keeps records satisfying an R-style expression. It can remove dose records, so use it only when the analysis population definition requires that. --obs-filter EXPR applies to observations while preserving dose records; it is usually safer for rules such as DV > 0 or a PK DVID selection because timing/dose context remains available.

For every filter, calculate before/after records, subjects, observations, doses, BLQ values, and key groups. A filter that retains zero observations should fail visibly, but a filter retaining the wrong subjects can still produce attractive figures.

Mutated copy and provenance

When mutation is requested, nlmx writes <stem>_mutated.<ext> into the output directory and reads that copy. The original is not changed. The log reports assignments and rows producing missing results. Preserve the copy because later figures refer to its columns rather than to the untouched source alone.

Reproducible population definition

Avoid undocumented interactive filtering. Put reviewed expressions in .eda, quote text comparisons, and test them against a subject/record ledger. A useful disposition records the expression, purpose, number excluded, and whether doses were retained.

Common mistakes

  • Expecting a filter to run before a derived column is created.
  • Using --filter when only observations should be removed.
  • Comparing EDA with QC without applying the same population rule.
  • Ignoring mutation warnings on dose rows or missing inputs.

Checklist

  • Write the intended order in the analysis record.
  • Test assignments before filters.
  • Reconcile every population count.
  • Preserve dose context where required.
  • Archive the mutated dataset with the result.

Further reading

See mutation grammar, mutation recipes, and output provenance.