r-bayes
Patterns for Bayesian inference in R using brms, including multilevel models, DAG validation, and marginal effects. Use when performing Bayesian analysis.
npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill r-bayes --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
## Core Packages ```r library(brms) library(cmdstanr) library(dagitty) library(ggdag) library(marginaleffects) library(tidybayes) library(bayesplot) ``` ## Directed Acyclic Graphs (DAGs) Prior to causal inference, create and validate DAGs with dagitty and ggdag. ### Define DAG Structure ```r dag <- dagitty(' dag { # Node positions for visualization exposure [pos="0,1"] mediator [pos="1,1"] outcome [pos="2,1"] confounder [pos="1,0"] # Edges (arrows) confounder -> exposure confounder -> outcome exposure -> mediator mediator -> outcome exposure -> outcome } ') ``` ### Identify Adjustment Sets ```r # For direct effect adjustmentSets(dag, exposure = "treatment", outcome = "outcome", effect = "direct") # For total effect adjustmentSets(dag, exposure = "treatment", outcome = "outcome", effect = "total") ``` ### Validate DAG Against Data ```r # Get implied conditional independencies implied_cis <- impliedConditionalIndependencies(dag) # Test against data ci_results <- localTests(dag, data = analysis_data, type = "cis") # Assess validation ci_df <- as.data.frame(ci_results) ci_df$independent <- ci_df$p.value > 0.05 pct_supported <- 100 * mean(ci_df$independent, na.rm = TRUE) cat(sprintf("DA
- Core Packages
- Directed Acyclic Graphs (DAGs)
- Define DAG Structure
- Identify Adjustment Sets
- Validate DAG Against Data
- Visualize DAG
- Bayesian Regression with brms
- Standard Configuration
- Priors
- Common Families
- Multilevel Models
- Random Intercepts
- Random Slopes
- Crossed Random Effects
What does the r-bayes skill do?
Patterns for Bayesian inference in R using brms, including multilevel models, DAG validation, and marginal effects. Use when performing Bayesian analysis.
How do I install it?
Run `npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill r-bayes --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From brycewang-stanford/Auto-Empirical-Research-Skills, a repository with 3,244 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.