help for dpath

Title

dpath — construct and audit longitudinal decision paths

Syntax

dpath build varname [if] [in] ,
id(idvar) time(timevar)
[group(groupvar) outcome(outcomevar)]

dpath describe ,
id(idvar) time(timevar)
[by(groupvar)]

dpath dri ,
id(idvar) time(timevar)
[by(groupvar)]

dpath entropy ,
id(idvar) time(timevar)
[by(groupvar) mutualinfo]

dpath equity ,
id(idvar) time(timevar) by(groupvar)
[ref(reflevel)]

dpath audit varname [if] [in] ,
id(idvar) time(timevar)
[by(groupvar) ref(reflevel) outcome(outcomevar)]

Description

dpath is a Stata package for constructing and auditing longitudinal
decision paths from panel data. It implements the Decision Infrastructure
Paradigm (Hait, 2026), which conceptualizes institutional AI systems
as infrastructure generating time-ordered binary decision
sequences — the decision path — as the primary empirical object.

The typical workflow is:

1. dpath build — compute decision-path variables from the panel dataset.

2. dpath describe — summarise path descriptors per unit.

3. dpath dri — compute the Decision Reliability Index.

4. dpath entropy — compute Shannon path entropy.

5. dpath equity — run equity diagnostics by group.

Or use dpath audit to run all five steps in sequence.

Subcommands

dpath build

Converts a long-format panel dataset into decision-path variables.
The decision variable must be binary (0/1). After running dpath build,
the following new variables are added to the dataset:

_dp_path_str — decision path string, e.g. "0-1-1-0"

_dp_dosage — proportion of waves with decision = 1

_dp_switch — switching rate (proportion of changes)

_dp_onset — first wave with decision = 1

_dp_duration — count of waves with decision = 1

_dp_longest — longest consecutive run of decision = 1

_dp_n_periods — number of observed waves per unit

_dp_treat_count— total count of treated waves

dpath describe

Displays summary statistics for all path descriptors at the unit level,
optionally stratified by a group variable. Requires dpath build to
have been run first.

dpath dri

Computes the Decision Reliability Index:

DRI = 1 - mean(switching_rate)

DRI = 1.0 indicates perfectly consistent decisions (Type I infrastructure).
DRI = 0.0 indicates maximum instability (highly adaptive or human-overridden).

Interpretation thresholds (adapted from Nunnally, 1978):

DRI ≥ 0.90: High reliability (suggests Type I infrastructure)

DRI 0.70–0.89: Acceptable (Type II)

DRI 0.50–0.69: Questionable (Type III)

DRI < 0.50: Poor reliability (Type IV)

dpath entropy

Computes Shannon entropy H of the decision-path distribution:

H = −Σ p(ω) × log₂ p(ω) [bits]

where p(ω) is the proportion of units following path ω. The normalised
entropy H* = H / log₂(K) rescales to [0, 1] across systems with different
numbers of unique paths K.

The mutualinfo option additionally computes mutual information
I(path; group), which partitions total entropy into within-group and
between-group components.

dpath equity

Produces equity diagnostics via standardised mean differences (SMDs) across
path descriptors (dosage, switching rate, onset, duration, DRI) between
group levels and a reference group.

Interpretation of |SMD|:

< 0.10 : negligible — equity achieved

0.10–0.20 : small disparity

> 0.20 : meaningful inequity

dpath audit

Runs all five steps in sequence: build, describe, dri, entropy, equity.
Produces a full audit report and suggests an infrastructure type based on
DRI and normalised entropy.

Options

id(idvar) — unit identifier variable (required).

time(timevar) — time/wave variable (required).

group(groupvar) / by(groupvar) — grouping variable for
stratified analysis and equity diagnostics.

outcome(outcomevar) — outcome variable (stored for reference;
not used in path computations).

ref(reflevel) — reference category for equity SMD comparisons.
Defaults to the first level of the group variable.

mutualinfo — (entropy only) compute mutual information I(path; group).

Examples

* ── Minimal example ─────────────────────────────────────────────────────

. use panel_data.dta, clear

. xtset studentid wave

* Step 1: Build decision-path variables

. dpath build ai_flag, id(studentid) time(wave) group(sesq)

* Step 2: Path descriptors

. dpath describe, id(studentid) time(wave) by(sesq)

* Step 3: Decision Reliability Index

. dpath dri, id(studentid) time(wave) by(sesq)

* Step 4: Shannon entropy

. dpath entropy, id(studentid) time(wave) by(sesq)

* Step 5: Equity diagnostics

. dpath equity, id(studentid) time(wave) by(sesq) ref(Q1)

* ── Full audit (all five steps) ─────────────────────────────────────────

. dpath audit ai_flag, id(studentid) time(wave) by(sesq) ref(Q1)

* ── Access stored results ───────────────────────────────────────────────

. dpath audit ai_flag, id(studentid) time(wave)

. display r(DRI)

. display r(entropy)

Returned results

dpath audit (and individual subcommands) store results in r():

r(n_units) — number of units

r(n_waves) — maximum number of waves

r(balanced) — 1 if balanced panel

r(mean_dosage) — mean dosage

r(mean_switch) — mean switching rate

r(DRI) — Decision Reliability Index

r(entropy) — Shannon entropy H (bits)

r(normalized_entropy) — normalised entropy H*

r(n_unique_paths) — number of unique paths

r(mutual_info) — mutual information (if requested)

Infrastructure Typology

The Decision Infrastructure Paradigm (Hait, 2026) defines four types:

Type I — Static: DRI ≈ 1.0, low entropy.
Decision rule fixed; paths rarely change.

Type II — Periodic: DRI 0.70–0.95, medium entropy.
Recalibrated at fixed intervals.

Type III — Continuous: DRI 0.40–0.70, high entropy.
Updates at every wave; fully adaptive.

Type IV — Human-in-Loop: DRI < 0.50, high entropy.
Algorithmic recommendations + human overrides.

References

Cronbach, L. J. (1951). Coefficient alpha and the internal structure of
tests. Psychometrika, 16(3), 297–334.

Hait, S. (2026). Artificial intelligence as decision infrastructure:
Rethinking institutional decision processes. Michigan State University.
https://github.com/causalfragility-lab/decisionpaths

Nunnally, J. C. (1978). Psychometric theory (2nd ed.). McGraw-Hill.

Shannon, C. E. (1948). A mathematical theory of communication.
Bell System Technical Journal, 27(3), 379–423.

Author

Subir Hait

Michigan State University

haitsubi@msu.edu

ORCID: 0009-0004-9871-9677

https://github.com/causalfragility-lab/dpath

Companion R package: decisionpaths

Also see

xtset, xtsum, xtdes