hinna0818/ukbanalytica_v2/ukbsci-regression
Claude Code and agent skill by hinna0818/ukbanalytica_v2
- community
Checking that the SKILL.md file is still in the repository.
Fit linear, logistic, Cox, GLM, negative-binomial, GAM, Fine-Gray competing-risk, lagged Cox, trend, PH-diagnostic, and restricted cubic spline models on UK Biobank Research Analysis Platform (RAP) cohorts built with UKBAnalytica. Wraps runmulti_lm, runmulti_logit, runmulti_cox, runmulti_glm, runmulti_negbin, runmulti_gam, run_regression, runmulti_cox_lag, runmulti_cox_zph, runmulti_competing, runmulti_trend, ukb_cox_diagnostics, run_rcs, and plot_rcs. Use this skill when the user asks to fit any regression model on the cohort, run batch regressions across multiple exposures, fit count/rate outcomes with Poisson/quasi-Poisson/Gamma GLM, fit negative-binomial for overdispersed counts, screen for non-linearity with GAM, check proportional-hazards assumptions, run a lagged sensitivity analysis, perform competing-risks Fine-Gray modeling, test a dose-response trend, or draw an exposure-response RCS curve. Triggers: UKB regression, Cox model, logistic regression, GLM, Poisson, negative binomial, GAM, batch regression, proportional hazards, competing risks, Fine-Gray, p_trend, restricted cubic spline, RCS, 非线性, UKB 回归, Cox 模型, 广义线性模型, 广义加性模型, /ukbsci-regression. Hard rule: local agents must not read or inspect real UKB RAP participant-level data; generate scripts for RAP execution and interpret aggregate outputs only.
Install
npx vskill@latest install hinna0818/ukbanalytica_v2/ukbsci-regressionSKILL.md
ukbsci-regression — UK Biobank batch regression
0. RAP guardrails
Strict local-agent boundary: this skill is for script generation, workflow planning, package guidance, and interpretation of aggregate outputs. The agent must not read, inspect, summarize, or process real UK Biobank RAP participant-level data, including de-identified row-level tables, raw RAP fields, exact dates, per-row predictions, row-level SHAP matrices, screenshots, tracebacks, or logs containing row-level values. Generate scripts for the user to run inside RAP; only aggregate results or rendered figures may be shared back with the agent. See ../references/agent-privacy-boundary.md.
Input: a cohort data.table produced by ukbsci-cohort (or any preprocessed UKB analysis dataset) that already lives in RAP project storage. Output: aggregate coefficient tables (estimate / CI / p-value), which may be shared with the local agent.
Forbidden: writing per-participant predicted values / residuals / influence diagnostics to local disk. Keep those in /mnt/project/... if you need them for QC.
1. When to load
- Fit one or several univariate / multivariable Cox, logistic, linear, GLM,
negative-binomial, or GAM models on a UKB cohort.
- Batch-run regression across many exposures at once (each gets its own model).
- Count or rate outcomes with Poisson, quasi-Poisson, Gamma, or other GLM families.
- Overdispersed count outcomes (negative-binomial as a principled alternative to
quasi-Poisson).
- Screen for non-linear dose-response associations with GAM splines.
- Fit and visualize restricted cubic spline exposure-response curves.
- Check the proportional-hazards assumption for Cox models.
- Run a lagged sensitivity analysis (drop events in the first N years).
- Fine-Gray competing-risks modeling.
- Linear-trend ("p-trend") testing across ordered exposure categories.
2. When NOT to load
- Building the cohort or survival dataset →
ukbsci-cohort. - Subgroup × interaction tests →
ukbsci-subgroup-sensitivity. - IPTW / propensity-adjusted regression →
ukbsci-propensity. - Multiple-imputation pooling →
ukbsci-imputation. - KM curves / cumulative incidence / time-dependent ROC →
ukbsci-survival. - Forest plots of the output →
ukbsci-plot.
3. Prerequisites
For competing-risks models the user needs a separate competing-event indicator (e.g. non-cardiovascular death dates), or a single status column encoded as 0 = censored, 1 = primary event, 2 = competing event.
4. Pipeline (4 phases)
Phase 1 — Pick the right model family
| Question | Function | Outcome | |
|---|---|---|---|
| Continuous outcome | runmulti_lm() | numeric (e.g. SBP, BMI, biomarker) | |
| Binary outcome at fixed time | runmulti_logit() | 0/1 | |
| Time-to-event with censoring | runmulti_cox() | outcome_status + outcome_surv_time | |
| Count / rate outcome (Poisson, Gamma…) | runmulti_glm() | any GLM family | |
| Overdispersed count outcome | runmulti_negbin() | non-negative integer | |
| Non-linear dose-response screening | runmulti_gam() | any smooth GAM family | |
| Time-to-event + competing risk | runmulti_competing() | status with {0,1,2} coding | |
| Cox with PH diagnostics | runmulti_cox_zph() | same as Cox | |
| Cox with early-event exclusion | runmulti_cox_lag() | same as Cox | |
| Ordered exposure trend | runmulti_trend() | depends on model_type | |
| Restricted cubic spline | run_rcs() + plot_rcs() | Cox, logistic, or linear |
Unified interface: run_regression(type = c("lm","logit","cox","glm","negbin","gam")) wraps all six base model families — use it when the model type is determined programmatically or you want a single consistent call site.
Phase 2 — Choose exposures & covariates
The *_multi_* family runs one model per `main_var` but shares the same covariate set. Build the covariate set from the analysis plan, e.g.
Phase 3 — Fit
Restricted cubic spline exposure-response
Use RCS when the user asks for an interpretable nonlinear exposure-response curve, especially for continuous environmental, biomarker, or omics exposures. For quick screening across many exposures, runmulti_gam() is lighter; for a publication-ready single-exposure curve, use run_rcs() and plot_rcs().
Interpretation: p_overall tests whether the exposure is associated with the outcome; p_nonlinear tests whether the spline improves over a linear term. Do not export prediction grids with participant IDs; aggregate curve data and figures are safe to share.
Unified interface
Phase 4 — Diagnostics & extensions
4a. PH diagnostics (Schoenfeld residual test)
A TRUE in ph_violation means the exposure may have a time-varying effect; consider stratifying the offending covariate or adding a tt() term in a follow-up model.
4b. Lagged sensitivity
Drops participants whose event occurred within lag_years of baseline — guards against reverse causation.
The output is long: one row per (lag_years, variable, level) triple.
4c. Competing risks (Fine-Gray subdistribution hazard)
Two coding modes:
Output: subdistribution hazard ratios (SHR) instead of HR.
4d. Trend across ordered exposure categories
Output: per-level estimates plus an overall p_trend per exposure.
4e. Bespoke PH diagnostics for a single fitted Cox object
5. Common pitfalls
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinginst/skills/UKBAnalytica_skills/ukbsci-regression/SKILL.md
Popularity
- Repository stars
- 35
- 7-day trend score
- 18
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 2 Sep 2026, 2 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hinna0818/ukbanalytica_v2/ukbsci-regression)