R Stats

Other

82 statistical analysis methods in R — regression, survival, Bayesian, meta-analysis, causal inference, SEM, IRT, clinical trial design, and more. JSON spec driven, reproducible, with mandatory effect sizes and assumption checks. Use when: user asks for statistical analysis, hypothesis testing, regression, ANOVA, t-test, chi-square, correlation, survival analysis, Cox regression, meta-analysis, propensity score, causal inference, SEM, IRT, power analysis, sample size calculation, time series forecasting, mixed models, Bayesian analysis, ROC/AUC, agreement/reliability, zero-inflated models, penalized regression, LASSO, group sequential design, or mentions R packages like ggplot2, brms, survival, metafor, lavaan, glmnet, mice, lme4, gee, dagitty, tmle. Multilingual triggers — EN: statistics, regression, significance, predict; ZH: 统计分析, 回归, 检验, 预测, 显著性, 生存分析, 元分析, 贝叶斯; JA: 統計分析, 回帰, 検定, 予測; KO: 통계분석, 회귀, 검정; ES: análisis estadístico, regresión; FR: analyse statistique, régression; DE: statistische Analyse, Regression; PT: análise estatística, regressão; RU: статистический анализ, регрессия; AR: تحليل إحصائي.

Audits

Pending

Install

openclaw skills install r-stats

OpenClaw R Stats

When to Use

User asks for any statistical analysis, hypothesis testing, group comparison, prediction, association, survival analysis, meta-analysis, causal inference, power/sample size, or mentions R statistical packages.

What This Skill Does NOT Do

  • Claim causality from observational data (use "associated with")
  • Run large exploratory fishing without clear user intent
  • Silently ignore assumption violations
  • Report only p-values (always include effect sizes and CIs)

Pre-Flight (Mandatory)

  1. Confirm dataset exists and is readable
  2. Run schema inspection: bash {baseDir}/scripts/run-rstats.sh schema --data <path>
  3. Report: rows, columns, types, missing values
  4. If missing > 5%, warn. If n < 30, warn small sample.

Environment Setup

First time or errors: bash {baseDir}/scripts/run-rstats.sh doctor

Install by profile (only when needed):

ProfileScriptMethods
Coreinstall-core.Rt-test, regression, ANOVA, chi-sq
Survivalinstall-survival.RKM, Cox, competing risks, RMST
Missinginstall-missing.RMICE, MCAR test
Mixedinstall-mixed.RLMM, GLMM, GEE, ICC
Bayesinstall-bayes.Rbrms, Bayes factors
Causalinstall-causal.RPSM, IPTW, IV, DiD, RDD, TMLE
Metainstall-meta.Rmeta-analysis, NMA
SEMinstall-sem.RSEM, CFA, lavaan
Diagnosticinstall-diagnostic.RROC, kappa, alpha
Advancedinstall-advanced.RGAM, quantile, zero-inflated
Powerinstall-power.Rpower/sample size

Workflow

  1. Determine analysis type (see references/METHOD_TABLE.md)
  2. Inspect dataset schema
  3. Build JSON spec:
{
  "dataset_path": "<path>",
  "analysis_type": "<type>",
  "outcome": "<column>",
  "predictors": ["<col1>"],
  "hypothesis": "<plain language>",
  "alpha": 0.05,
  "seed": 42,
  "output_dir": "<path>"
}
  1. Save as .json, run: bash {baseDir}/scripts/run-rstats.sh analyze --spec <path>
  2. Read summary.json + report.md
  3. Present: Summary → Statistics → Interpretation → Plots → Assumptions → Caveats

Analysis Selection

For the complete 82-method table with user intent mapping, see references/METHOD_TABLE.md.

Quick lookup — most common:

Intentanalysis_type
Compare 2 groupsttest or wilcoxon
Compare 3+ groupsanova or kruskal
Categorical associationchisq or fisher
Predict continuouslinear_regression
Predict binarylogistic_regression
Survival curveskaplan_meier
Survival regressioncox_regression
Meta-analysismeta_analysis
Causal effectpropensity_match or did
Power/sample sizepower_analysis

Automatic Method Switching

  • Non-normal + n < 30 → wilcoxon over ttest
  • Unequal variance → Welch t-test (equal_var: false)
  • Expected cells < 5 → fisher over chisq
  • Overdispersion in Poisson → suggest negative binomial
  • Heteroscedastic residuals → robust SE warning

Reporting Rules (Non-Negotiable)

Every analysis MUST include:

  • Sample size (n) and missing data handling
  • Method name and rationale
  • Point estimates with confidence intervals
  • Effect sizes (Cohen's d, η², R², OR, HR, etc.)
  • Assumption check results
  • Limitations

Language: "associated with" / "evidence suggests" — NEVER "proves" / "causes"

Spec Field Reference

See references/SPEC_REFERENCE.md for required/optional fields per analysis_type.