| Type: | Package |
| Title: | Model-Aware Validation and Audit Certificates for Statistical Analyses |
| Version: | 0.1.0 |
| Description: | Provides model-aware behavioral validation and audit certificates for statistical analyses. Controlled transformations and model-specific diagnostic checks are organized across five domains: computational integrity, numerical stability, design adequacy, assumption screening, and influence stability. Supported workflows include linear models, generalized linear models, classical and repeated-measures analyses of variance, mixed-effects models fitted using 'lme4' or 'glmmTMB', and survival models fitted using 'survival'. Checks are selected according to registered applicability conditions for each model class. The resulting certificates describe computational behavior and selected diagnostic findings; they do not establish causal validity, model correctness, or scientific appropriateness. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.1.0) |
| Imports: | graphics, reformulas, stats, tools |
| Suggests: | afex, glmmTMB, knitr, lme4, rmarkdown, survival, testthat (≥ 3.0.0) |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| URL: | https://github.com/George33cy/statwitness |
| BugReports: | https://github.com/George33cy/statwitness/issues |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-07-12 10:13:36 UTC; georg |
| Author: | Georgios P. Georgiou [aut, cre] |
| Maintainer: | Georgios P. Georgiou <georgiou.georg@unic.ac.cy> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-21 10:40:08 UTC |
Model-Aware Validation and Audit Certificates for Statistical Analyses
Description
Model-aware computational validation for regression, ANOVA, repeated-measures, mixed-effects, and survival workflows.
Details
The package applies registered transformations with known expected behavior. Certificates do not establish causal validity or scientific appropriateness.
Preview an Automatic Audit Plan
Description
Fits the requested model and reports which registered audits are applicable.
Usage
audit_plan(
formula,
data,
focus = NULL,
family = NULL,
weights = NULL,
method = "auto",
engine = NULL,
control = NULL,
audit_level = c("standard", "core", "thorough")
)
Arguments
formula |
A model formula. |
data |
A data frame. |
focus |
An optional coefficient, variable, or omnibus term. |
family |
An optional model family. |
weights |
Optional analysis weights. |
method |
Requested fitting method. |
engine |
Optional custom fitting function. |
control |
Optional model-specific control object. |
audit_level |
Audit breadth used to construct the plan. |
Value
A data frame of selected and skipped tests with reasons.
Generate a Behavioral Validation Certificate
Description
Fits a supported model, chooses mathematically applicable behavioral tests, applies controlled transformations, and checks whether the analysis responds as expected.
Usage
statwitness(
formula,
data,
focus = NULL,
family = NULL,
weights = NULL,
method = "auto",
engine = NULL,
control = NULL,
conf_level = 0.95,
tolerance = 1e-07,
seed = 20260712,
include = NULL,
exclude = NULL,
audit_level = c("standard", "core", "thorough")
)
Arguments
formula |
A model formula. Random-effect terms using |
data |
A data frame containing all analysis variables. |
focus |
An optional coefficient, predictor, or omnibus term such as |
family |
An optional GLM or GLMM family. |
weights |
Optional analysis weights or the name of a weight column. |
method |
One of |
engine |
An optional custom fitting function. |
control |
An optional model-specific control object. |
conf_level |
Confidence level for coefficient intervals. |
tolerance |
Relative numerical tolerance. |
seed |
Seed for deterministic perturbations. |
include |
Optional test identifiers to retain. |
exclude |
Optional test identifiers to omit. |
audit_level |
Audit breadth: |
Value
An object of class statwitness_audit.
Examples
dat <- transform(mtcars, transmission = factor(am))
audit <- statwitness(mpg ~ transmission + wt, data = dat, focus = "transmission")
print(audit)
Audit a Repeated-Measures ANOVA
Description
Fits a repeated-measures ANOVA using afex::aov_ez() and checks design
integrity, sphericity handling, row-order and participant-label invariance,
outcome transformations, residual screening, and feasible participant-deletion
influence checks.
Usage
statwitness_repeated(
data,
outcome,
id,
within,
between = NULL,
focus = NULL,
type = 3,
correction = "GG",
tolerance = 1e-07,
seed = 20260712,
audit_level = c("standard", "core", "thorough")
)
Arguments
data |
A long-format data frame. |
outcome |
Name of the numeric outcome column. |
id |
Name of the participant identifier column. |
within |
Character vector of within-subject factor names. |
between |
Optional between-subject factor names. |
focus |
Optional omnibus effect name. |
type |
Sums-of-squares type passed to |
correction |
Sphericity correction, usually |
tolerance |
Relative numerical tolerance. |
seed |
Seed for row-order testing. |
audit_level |
Audit breadth: |
Value
An object of class statwitness_audit.
List Registered Behavioral Audit Tests
Description
Returns the built-in statwitness audit registry.
Usage
witness_registry()
Value
A data frame describing registered tests, supported model families, and purposes.