Guide for creating DAAF agent definition files. Covers 12-section template, hook registration, skills-in-frontmatter, integration checklist. Use when adding or revising agents. For SKILL.md files, use skill-authoring instead.
中文简介正在准备中。当前显示原文说明。
R statistical modeling with base stats, sandwich, lmtest, car, broom. OLS/WLS/ GLS via lm(), GLMs via glm() (logit, probit, Poisson, negative binomial), robust/clustered SEs via sandwich+lmtest, diagnostics via car, tidy output via broom. Use when execution language is R. Python equivalent: statsmodels. For FE regressions use fixest; for panel RE/between use plm; for complex surveys use survey-r.
中文简介正在准备中。当前显示原文说明。
实测评分 未实测
查看安装方法安装前可以查看交给 AI 代理的指令内容。
R's statistical modeling ecosystem centered on base stats with key extension
packages: sandwich for robust/clustered variance estimators, lmtest for
coefficient testing with custom covariance matrices, car for regression
diagnostics and hypothesis tests, broom for tidy model output, and
MASS for negative binomial regression. Covers OLS/WLS/GLS via lm(), GLMs
via glm() (logit, probit, Poisson, negative binomial, Gamma), robust and
clustered standard errors via sandwich+lmtest, diagnostics (VIF,
heteroskedasticity tests, normality tests), tidy output via broom, and classical
hypothesis tests (t, chi-squared, Wilcoxon, Fisher). Use when execution language
is R and the model does not require absorbed fixed effects or panel structure.
Python equivalent: statsmodels. For fixed effects regressions use fixest;
for panel RE/between/Fama-MacBeth use plm; for complex survey designs use
survey-r.
R is the original statistical computing environment. The stats package ships
with every R installation and provides the core modeling functions that the
entire R ecosystem builds upon:
y ~ x1 + x2 — the original formula syntax that Python
libraries (patsy, formulaic) later adoptedlm() for OLS, WLS, GLS; summary(), confint(),
predict(), anova() for post-estimationglm() with family/link specifications
(binomial/logit, Poisson/log, Gamma/inverse, etc.)t.test(), chisq.test(), wilcox.test(),
fisher.test(), prop.test(), ks.test(), cor.test()ts(), arima(), acf(), pacf(), stl()The extension packages covered by this skill complete the modeling toolkit:
| Package | Version | Role |
|---|---|---|
sandwich | 3.1-1 | Robust (HC0-HC4) and clustered variance-covariance estimators |
lmtest | 0.9-40 | coeftest() with custom vcov; bptest(), dwtest(), bgtest() |
car | 3.1-5 | vif(), linearHypothesis(), ncvTest(), Anova (type II/III) |
broom | 1.0.12 | tidy(), glance(), augment() for tidy model output |
MASS | 7.3-65 | glm.nb() for negative binomial; stepAIC() |
modelsummary | 2.6.0 | Publication-quality regression tables (multiple models) |
marginaleffects | 0.32.0 | Average marginal effects, contrasts, predictions |
|> native pipe (R 4.1+) is the
preferred pipe style in DAAF scripts (not magrittr %>%).| File | Purpose | When to Read |
|---|---|---|
quickstart.md | lm() basics, summary(), confint(), predict(), formula syntax | Starting with R stats or need formula reference |
glm.md | glm() families, MASS::glm.nb(), link functions, deviance, overdispersion | Non-linear models, binary/count outcomes |
robust-se.md | sandwich vcovHC/vcovCL/vcovHAC, lmtest coeftest() | Robust or clustered standard errors |
diagnostics.md | car::vif(), linearHypothesis(), residual analysis, heteroskedasticity tests | Checking model assumptions |
reporting.md | broom tidy/glance/augment, modelsummary, marginaleffects | Tidy output, publication tables, marginal effects |
tests.md | t.test(), chisq.test(), wilcox.test(), fisher.test(), correlation tests | Classical hypothesis tests |
time-series.md | ts objects, arima(), acf/pacf, Durbin-Watson, ADF test | Time series analysis |
gotchas.md | Formula pitfalls, factor contrasts, na.action, predict() type arg | Debugging common issues |
quickstart.md then robust-se.mdquickstart.md then glm.mdrobust-se.mddiagnostics.mdreporting.mdquickstart.md (R is the original formula syntax)The reference-file routing in this skill applies to advisory and brainstorming turns as much as implementation. Recommending a model, reviewing an analysis plan, or answering a question that touches a routed topic calls for reading the routed reference file just as much as writing code does — the reference files carry curated caveats and environment-specific constraints (e.g., which packages are pre-installed, sandwich function signatures) that this overview and general knowledge lack.
.fit() call; R returns fitted object from lm()
directly)lm() with weights is NOT equivalent to survey-weighted regression — it does
not account for stratification, clustering, or finite population correctionsreporting.md) uses gt as its default backendWhat kind of regression?
+-- Linear (continuous outcome)
| +-- Basic OLS --> ./references/quickstart.md
| +-- Weighted least squares --> ./references/quickstart.md (WLS section)
| | (WLS != survey-weighted regression -- for complex surveys, use survey-r)
| +-- Robust to outliers (M-estimator) --> MASS::rlm() in ./references/quickstart.md
| +-- Quantile regression --> quantreg::rq() (external package)
| +-- Need fixed effects?
| +-- Use fixest instead (faster FE absorption)
+-- Binary outcome (0/1)
| +-- Logit --> ./references/glm.md
| +-- Probit --> ./references/glm.md
+-- Count outcome (0, 1, 2, ...)
| +-- Poisson --> ./references/glm.md
| +-- Negative binomial --> ./references/glm.md (MASS::glm.nb)
| +-- Zero-inflated --> pscl package (external)
+-- Ordinal (ordered categories)
| +-- MASS::polr() --> ./references/glm.md
+-- GLM (custom family/link)
| +-- glm() framework --> ./references/glm.md
+-- Need robust/clustered SEs?
+-- sandwich + lmtest --> ./references/robust-se.md
What assumption to check?
+-- Heteroskedasticity --> ./references/diagnostics.md
| +-- Breusch-Pagan (lmtest::bptest)
| +-- NCV test (car::ncvTest)
+-- Normality of residuals --> ./references/diagnostics.md
| +-- Shapiro-Wilk (shapiro.test)
| +-- Jarque-Bera (tseries::jarque.bera.test)
+-- Multicollinearity --> ./references/diagnostics.md
| +-- VIF (car::vif)
+-- Specification / functional form --> ./references/diagnostics.md
| +-- RESET test (lmtest::resettest)
+-- Serial correlation --> ./references/diagnostics.md
| +-- Durbin-Watson (lmtest::dwtest)
| +-- Breusch-Godfrey (lmtest::bgtest)
+-- Joint hypothesis test --> ./references/diagnostics.md
| +-- car::linearHypothesis
+-- Influential observations --> ./references/diagnostics.md
+-- Cook's distance, leverage, DFBETAS
What test?
+-- Compare two means --> ./references/tests.md
| +-- t.test() (parametric)
| +-- wilcox.test() (non-parametric)
+-- Compare proportions --> ./references/tests.md
| +-- prop.test()
+-- Test independence --> ./references/tests.md
| +-- chisq.test() (large sample)
| +-- fisher.test() (exact, small sample)
+-- Test correlation --> ./references/tests.md
| +-- cor.test() (Pearson, Spearman, Kendall)
+-- Goodness of fit --> ./references/tests.md
| +-- chisq.test() with expected frequencies
| +-- ks.test() (Kolmogorov-Smirnov)
Common issues?
+-- Formula I() for arithmetic --> ./references/gotchas.md
+-- Factor contrasts (treatment vs sum) --> ./references/gotchas.md
+-- predict() type argument --> ./references/gotchas.md
+-- na.action behavior --> ./references/gotchas.md
+-- summary() vs anova() --> ./references/gotchas.md
+-- Convergence warnings (GLM) --> ./references/gotchas.md
+-- r-stats vs fixest boundary --> ./references/gotchas.md
Important: In data research pipelines (see CLAUDE.md), R analyses are
executed through script files, not interactively. This ensures auditability
and reproducibility.
The pattern:
scripts/stage8_analysis/{step}_{model-name}.RClosely read agent_reference/SCRIPT_EXECUTION_REFERENCE.md for the mandatory
file-first execution protocol covering complete code file writing, output
capture, and file versioning rules.
See:
agent_reference/SCRIPT_EXECUTION_REFERENCE.md -- Script execution protocol
and format with validationThe examples below show R syntax. In research workflows, wrap them in scripts following the file-first pattern.
# --- Config ---
library(sandwich) # Robust variance estimators
library(lmtest) # Coefficient testing with custom vcov
library(car) # Diagnostics: VIF, linearHypothesis
library(broom) # Tidy model output
library(MASS) # glm.nb(), polr(), rlm()
library(modelsummary) # Publication tables
library(marginaleffects) # Marginal effects
| Operation | Code |
|---|---|
| OLS | lm(y ~ x1 + x2, data = df) |
| WLS | lm(y ~ x1 + x2, data = df, weights = w) |
| Logit | glm(y ~ x1 + x2, data = df, family = binomial) |
| Probit | glm(y ~ x1 + x2, data = df, family = binomial(link = "probit")) |
| Poisson | glm(count ~ x1 + x2, data = df, family = poisson) |
| Neg. binomial | MASS::glm.nb(count ~ x1 + x2, data = df) |
| Gamma | glm(y ~ x1 + x2, data = df, family = Gamma(link = "log")) |
| Robust SE (HC1) | coeftest(fit, vcov = vcovHC(fit, type = "HC1")) |
| Clustered SE | coeftest(fit, vcov = vcovCL(fit, cluster = df$group)) |
| Summary | summary(fit) |
| Tidy output | broom::tidy(fit, conf.int = TRUE) |
| Model stats | broom::glance(fit) |
| Predict | predict(fit, newdata = new_df) |
| Confidence intervals | confint(fit) |
| VIF | car::vif(fit) |
| Joint hypothesis | car::linearHypothesis(fit, c("x1 = 0", "x2 = 0")) |
| Marginal effects | marginaleffects::avg_slopes(fit) |
| Pub table | modelsummary::modelsummary(list(fit1, fit2)) |
# Additive terms
y ~ x1 + x2 + x3
# Interaction (with main effects)
y ~ x1 * x2 # equivalent to x1 + x2 + x1:x2
# Interaction only (no main effects)
y ~ x1 : x2
# Factor variable (explicit)
y ~ factor(region)
# Suppress intercept
y ~ x1 + x2 - 1 # or: y ~ 0 + x1 + x2
# Polynomial: I() protects arithmetic operators
y ~ x1 + I(x1^2)
# Log transformation
y ~ log(income) + age
# All pairwise interactions
y ~ (x1 + x2 + x3)^2
| Topic | Reference File |
|---|---|
| lm() basics | ./references/quickstart.md |
| Formula syntax | ./references/quickstart.md |
| summary() output | ./references/quickstart.md |
| confint() | ./references/quickstart.md |
| predict() | ./references/quickstart.md |
| WLS / weighted regression | ./references/quickstart.md |
| Model matrix / design matrix | ./references/quickstart.md |
| anova() vs summary() | ./references/quickstart.md |
| Comparison to statsmodels | ./references/quickstart.md |
| glm() framework | ./references/glm.md |
| Logit / probit | ./references/glm.md |
| Poisson regression | ./references/glm.md |
| Negative binomial (MASS) | ./references/glm.md |
| Ordered logit/probit (MASS) | ./references/glm.md |
| GLM families and links | ./references/glm.md |
| Deviance and overdispersion | ./references/glm.md |
| Odds ratios and IRR | ./references/glm.md |
| Marginal effects | ./references/reporting.md |
| Robust SEs (HC0-HC4) | ./references/robust-se.md |
| Clustered SEs | ./references/robust-se.md |
| HAC / Newey-West SEs | ./references/robust-se.md |
| Bootstrap SEs | ./references/robust-se.md |
| coeftest() | ./references/robust-se.md |
| waldtest() | ./references/robust-se.md |
| VIF / multicollinearity | ./references/diagnostics.md |
| Breusch-Pagan test | ./references/diagnostics.md |
| NCV test | ./references/diagnostics.md |
| Shapiro-Wilk test | ./references/diagnostics.md |
| RESET test | ./references/diagnostics.md |
| Durbin-Watson test | ./references/diagnostics.md |
| Breusch-Godfrey test | ./references/diagnostics.md |
| linearHypothesis() | ./references/diagnostics.md |
| Cook's distance | ./references/diagnostics.md |
| Influence plots | ./references/diagnostics.md |
| Residual analysis | ./references/diagnostics.md |
| broom::tidy() | ./references/reporting.md |
| broom::glance() | ./references/reporting.md |
| broom::augment() | ./references/reporting.md |
| modelsummary tables | ./references/reporting.md |
| marginaleffects | ./references/reporting.md |
| t.test() | ./references/tests.md |
| chisq.test() | ./references/tests.md |
| wilcox.test() | ./references/tests.md |
| fisher.test() | ./references/tests.md |
| prop.test() | ./references/tests.md |
| ks.test() | ./references/tests.md |
| cor.test() | ./references/tests.md |
| ts objects | ./references/time-series.md |
| arima() | ./references/time-series.md |
| acf / pacf | ./references/time-series.md |
| Durbin-Watson (time series) | ./references/time-series.md |
| ADF test | ./references/time-series.md |
| Formula pitfalls (I()) | ./references/gotchas.md |
| Factor contrasts | ./references/gotchas.md |
| na.action behavior | ./references/gotchas.md |
| predict() type argument | ./references/gotchas.md |
| Convergence warnings | ./references/gotchas.md |
| r-stats vs fixest boundary | ./references/gotchas.md |
When base R stats functions are used as a primary analytical tool, include in the report's Software & Tools references:
R Core Team (2026). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/
For extension packages, cite when they contribute substantially to the analysis:
Zeileis, A. (2004). "Econometric Computing with HC and HAC Covariance Matrix Estimators." Journal of Statistical Software, 11(10), 1-17. (sandwich package)
Zeileis, A. & Hothorn, T. (2002). "Diagnostic Checking in Regression Relationships." R News, 2(3), 7-10. (lmtest package)
Fox, J. & Weisberg, S. (2019). An R Companion to Applied Regression, Third Edition. Sage, Thousand Oaks CA. (car package)
Robinson, D., Hayes, A., & Couch, S. (2023). broom: Convert Statistical Objects into Tidy Tibbles. R package. (broom package)
Arel-Bundock, V. (2022). "modelsummary: Data and Model Summaries in R." Journal of Statistical Software, 103(1), 1-23. (modelsummary package)
Arel-Bundock, V., Greifer, N., & Heiss, A. (2024). "How to Interpret Statistical Models Using marginaleffects for R and Python." Journal of Statistical Software, 111(9), 1-32. (marginaleffects package)
Cite when: The package's functions are central to the analytical approach (e.g., sandwich for robust inference, car for diagnostics). Do not cite when: Only used incidentally for output formatting.
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Guide for creating DAAF agent definition files. Covers 12-section template, hook registration, skills-in-frontmatter, integration checklist. Use when adding or revising agents. For SKILL.md files, use skill-authoring instead.
中文简介正在准备中。当前显示原文说明。
Researcher-facing analytic triangulation ("creative verification") for stress-testing provisional findings and designing pre-specified challenges before an analysis runs. Turns a researcher's concern or focal claim into competing explanations, bounded discriminating tests, audited diagnostic artifacts, and evidence-calibrated interpretations in a hypothesis/evidence ledger — behavioral, output-level verification replacing line-by-line code review. Covers 12 challenge families organized by Shadish-Cook-Campbell validity type, named sensitivity statistics, pre-committed interpretation rules, anti-fishing guardrails, and interactive diagnostic-artifact QA. Use in Ad Hoc Collaboration to verify, challenge, or stress-test a result, or to design discriminating tests before an analysis runs. Not code-change verification (verify skill / code review) and not final adjudication or re-execution (data-verifier, Reproducibility Verification) — prospective, hypothesis-driven challenge design of analytic claims.
中文简介正在准备中。当前显示原文说明。
In-situ smoke testing that verifies a LIVE DAAF deployment functions end-to-end in whatever provider route it is configured for. Auto-detects the active install route (anthropic-subscription, openrouter, chatgpt-subscription shim, openai-api shim) and runs tiered probes: Tier 0 free preflight (route/env coherence, hooks, statuslines, shim health); Tier 1 one live round-trip (~cents); Tier 2 a six-probe functional battery (dispatch, coding, web, skill loading, isolation-strip, nested-dispatch deny); Tier D a zero-cost deterministic battery (bats, Pester, lint, safety-hook tests). Use after install, after a rebuild or update, after any provider/config change (new API key, model remap, shim change), for pre-release validation, or when asked "is my install working" or to "smoke test the deployment/config." Requires the DAAF_DEV=1 dev image; a contributor tool, not end-user-facing. NOT DAAFBench (model behavioral-adherence evaluation under benchmarks/) and NOT scripts/smoke_tests/ (R/Python library-package smoke tests).
中文简介正在准备中。当前显示原文说明。
Operational framework for the DAAF orchestrator. Defines engagement modes, confirmation protocol, subagent dispatch, context budget, and reference-loading. Loaded exclusively by the orchestrator — not for subagents or user questions.
中文简介正在准备中。当前显示原文说明。
Data science methodology and method-selection routing for quantitative research. Covers EDA, data validation, descriptive analysis, causal inference (IV, DiD, RD, synthetic control), clustering/PCA/UMAP, supervised ML, geospatial analysis, network analysis, and visualization design. Contains the canonical method-to-library routing tree, routed by execution language — Python: statsmodels (OLS/GLM/time series), pyfixest (FE/DiD), linearmodels (RE/GMM/SUR), svy (complex surveys), scikit-learn (clustering/prediction ML), geopandas (spatial), igraph (network analysis); R: r-stats (OLS/GLM/time series), fixest (FE/DiD), plm (panel/RE/IV), survey-r (complex surveys), tidymodels (ML), sf-terra (spatial), igraph-r (network analysis). Load the routed tool-specific skill before giving tool-specific advice or writing code — library skills encode environment constraints and curated caveats absent from general knowledge.
中文简介正在准备中。当前显示原文说明。
Interpretation guidance for Urban Institute Education Data Portal datasets. The Portal is a curation layer over federal data: lowercase variable names, integer-encoded categoricals, standardized missing codes (-1 missing, -2 not applicable, -3 suppressed). Covers year definitions, grade encoding (grade=-1 is Pre-K, not missing), suppression rates, ODC-By licensing, and cross-source join identifiers. Load before analyzing any Portal data. Routes to source-specific deep-dive skills for individual datasets.
中文简介正在准备中。当前显示原文说明。