Data

Data and Code

Can he do the analysis himself, or only commission it?

I write the code. R first, Python alongside it, with the analysis plan fixed before the data are opened and the whole pipeline written so someone else can run it and get the same numbers. Large time-series files from monitors and sensors are the normal case, not the exception.

How I work:

  1. Evidence
  2. Written standard
  3. Evaluation
  4. A specific fix
  5. Guidance people keep following

Code is where a standard stops being a document and becomes a number somebody can check.


What I work with

Languages

R, used daily, with Python, SQL, SAS and Stata. Analyses are delivered as Quarto documents, so the code, the output and the write-up stay in one file.

Methods

Mixed-effects models for repeated measures, logistic regression, survival analysis, and causal methods: directed acyclic graphs, inverse probability weighting, difference in differences.

Data

Accelerometry and sensor time series, population registries (ARIC, CARDIA, MESA, NHANES, CPASS), and health record and claims data.

Discipline

Pre-specified analysis plans, including CDISC-compliant plans for trials, plus quality control rules, data validation and anomaly detection written before analysis starts.


Sample: the quality rules that run before any model

Illustrative sample

Illustrative sample. Synthetic data, not from any employer or client. The rules are the ones I apply to monitor data; the thresholds are set per study, in advance.

#CheckRule, fixed before the data arriveIf it fails
1Wear timeA day counts only with enough waking wear time, set in advanceThe day is dropped, and the number dropped is reported
2Implausible valuesReadings outside physiological range are flagged, never silently clippedFlagged rows go to review with their raw values kept
3Duplicate recordsOne record per person per timestamp, enforced by the join keyThe join is rejected rather than reconciled by guesswork
4Missing dataPattern described before modelling; mechanism stated, not assumedMultiple imputation, with complete cases as a sensitivity check
5Sentinel codesCodes such as 999 are mapped to missing in the import scriptThe import stops if an unmapped code appears

Sample: repeated measures, as the design intends

Illustrative sample

Illustrative sample. Synthetic data, not from any employer or client. The structure matches a crossover sitting trial: four conditions in the same person.

# R. Each participant does every condition, so person is a random effect.
library(lme4)
library(emmeans)

fit <- lmer(
  systolic ~ condition + period + (1 | id),
  data = sitting
)

# Pre-specified contrast: each break strategy against uninterrupted sitting
emmeans(fit, trt.vs.ctrl ~ condition, ref = "uninterrupted")

# Report the effect and its interval, never the p value alone.

Treating the four readings as independent would overstate precision. The random intercept is not a refinement, it is what the design requires.


Reproducible by default

  1. Analysis plan before the data
  2. Fixed random seeds
  3. Scripts, not spreadsheet edits
  4. Version control for every change
  5. Quarto output with code attached

The same habits run my AI work: SciencEye AI, the research assistant I built, is scored by a Python runner over a shared repository with more than 2,100 commits. See how that is evaluated.


More code

Full scripts, including the agreement analysis behind the wearables page and the evaluation scorer, are on Code and Notebooks.