| Title: | AssessLite: Test What Your Analysis Depends On |
|---|---|
| Description: | Structural assumption assessment for causal analysis. Makes the invariance assumptions behind a result explicit, attacks them with transformation tests (unit permutation, cluster holdout, temporal split, subgroup stability), returns three-way verdicts (stable, unstable, not resolvable), and exports the reasoning path as a durable audit record. AssessLite is the product, structural_audit() runs the assessment, and write_audit() writes the audit record. Sibling to 'recoverlite': recoverlite asks whether a method can recover the quantity it estimates; AssessLite asks what a result depends on and whether it survives the violation of those assumptions. R implementation of the AssessLite core specification v0.1. Records claim-to-source support, never truth: a stable verdict means the conclusion survived the attacks that were run, at the precision the data allowed. |
| Authors: | Heidi Andersén [aut, cre] (ORCID: <https://orcid.org/0000-0001-5923-5865>) |
| Maintainer: | Heidi Andersén <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 0.4.0 |
| Built: | 2026-07-12 21:33:49 UTC |
| Source: | https://github.com/heidihelena/assesslite |
Assume an invariance: the analysis relies on it and it should be attacked
assume_invariance(audit, invariance, rationale, licenses)assume_invariance(audit, invariance, rationale, licenses)
audit |
a structural_audit object. |
invariance |
a name from 'invariance_vocabulary()'. |
rationale |
why the claim is scientifically defensible here. |
licenses |
what inferential step the claim buys (pooling, transport, ...). |
the audit with the ledger entry added.
Build the pooling assumption lattice
assumption_lattice(audit)assumption_lattice(audit)
audit |
a structural_audit object (with a fitted estimate). |
the audit with a $lattice element.
Apply the decision rules to a tested audit
decide( audit, abstain_if = list(estimate_sign_changes = TRUE, effect_crosses_threshold = NULL) )decide( audit, abstain_if = list(estimate_sign_changes = TRUE, effect_crosses_threshold = NULL) )
audit |
a structural_audit after test_invariance(). |
abstain_if |
list of user-declared abstention rules: estimate_sign_changes (logical) and effect_crosses_threshold (numeric on the natural scale, or NULL). |
Declare a causal DAG for the graph_check and adjustment_check attacks
declare_graph(audit, edges, latent = character())declare_graph(audit, edges, latent = character())
audit |
a structural_audit object. |
edges |
character vector of directed edges, e.g. c("age -> adherence", "stage -> survival"). Nodes are the union of everything named. |
latent |
character vector of node names that are part of the causal structure but not measured (e.g. an unmeasured confounder). Latent nodes may not enter an adjustment set, and implications that touch them are not testable. |
Canonical invariance identifiers (core spec v0.1)
invariance_vocabulary()invariance_vocabulary()
Reject an invariance: the analyst asserts it does not hold here
reject_invariance(audit, invariance, rationale, licenses)reject_invariance(audit, invariance, rationale, licenses)
audit |
a structural_audit object. |
invariance |
a name from 'invariance_vocabulary()'. |
rationale |
why the claim is indefensible here. |
licenses |
what the rejection removes from scope. |
the audit with the ledger entry added.
Render the audit as a self-contained HTML report
render_report(audit, path)render_report(audit, path)
audit |
a structural_audit object after 'decide()'. |
path |
file path to write the HTML report to. |
the path, invisibly.
Declare the structure of a causal analysis and open its audit
structural_audit( data, outcome, exposure, covariates = character(), cluster = NULL, time = NULL, subgroups = character(), coords = NULL, unit_id = NULL, edges = NULL, unit = "unit", estimand = NULL )structural_audit( data, outcome, exposure, covariates = character(), cluster = NULL, time = NULL, subgroups = character(), coords = NULL, unit_id = NULL, edges = NULL, unit = "unit", estimand = NULL )
data |
data frame of the analysis sample. |
outcome |
a single column name for a GLM outcome, or c(time, status) column names for a Cox model (requires the survival package). |
exposure |
column name of the exposure of interest. |
covariates |
character vector of adjustment covariate names. |
cluster |
column name of the cluster variable (hospital, site), or NULL. |
time |
column name of the calendar-time variable, or NULL. |
subgroups |
character vector of subgroup variable names. |
coords |
length-2 character vector of coordinate columns c(x, y) for the spatial attack, or NULL. |
unit_id |
column naming each unit, required with 'edges', or NULL. |
edges |
a two-column data frame of undirected unit-id pairs defining a network for the interference attack, or NULL. |
unit |
what one row is (e.g. "patient"). |
estimand |
plain-language statement of the target quantity. |
a structural_audit object with the full-sample estimate fitted.
Run attacks against the declared invariances
test_invariance( audit, tests = c("unit_permutation", "cluster_holdout", "temporal_split", "subgroup_stability"), seed = 1, confounding_benchmark = 1.25, outcome_node = NULL, spatial_k = 3, tip_ratio = NULL, confounder_prevalence = 0.2, spatial_knn = 8, exposure_map = "mean" )test_invariance( audit, tests = c("unit_permutation", "cluster_holdout", "temporal_split", "subgroup_stability"), seed = 1, confounding_benchmark = 1.25, outcome_node = NULL, spatial_k = 3, tip_ratio = NULL, confounder_prevalence = 0.2, spatial_knn = 8, exposure_map = "mean" )
audit |
a structural_audit object with a populated ledger. |
tests |
character vector of attacks to run: unit_permutation, cluster_holdout, temporal_split, subgroup_stability, confounding_sensitivity, confounding_scenarios, graph_check, adjustment_check, positivity_check, spatial_holdout, interference_check. |
seed |
integer seed for the permutation test. |
confounding_benchmark |
plausible unmeasured-confounding strength on the E-value (risk-ratio) scale, used by confounding_sensitivity (default 1.25). |
outcome_node |
graph node to treat as the outcome for adjustment_check (default: the model's outcome column). |
spatial_k |
grid resolution (k x k blocks) for spatial_holdout (default 3). |
tip_ratio |
decision threshold on the ratio scale for confounding_scenarios, or NULL for the null (default NULL). |
confounder_prevalence |
assumed confounder prevalence for confounding_scenarios (default 0.2). |
spatial_knn |
neighbours for the spatial_autocorrelation weight matrix (default 8). |
exposure_map |
neighbour-exposure summary for interference_check: "mean" (default), "any", or "sum". |
the audit with the requested attacks recorded and ledger verdicts updated.
Write the audit to a JSON file conforming to the core audit schema
write_audit(audit, path)write_audit(audit, path)
audit |
a structural_audit object after 'decide()'. |
path |
file path to write the JSON audit record to. |
the path, invisibly.