本文へ移動
cccskills
無料GitHub で公開

data-analysis

End-to-end R data analysis for the sewage project. Writes analysis scripts following project conventions (here::here, arrow/parquet, fixest, modelsummary, native pipe), runs code review, and produces publication-ready tables and figures. This skill should be used when asked to "run an analysis", "estimate the model", "add a specification", or "write an R script".

インストール方法を見る

含まれるファイル(1)

  • SKILL.md4.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Data Analysis

Run an end-to-end data analysis following sewage project conventions.

Input: $ARGUMENTS — a dataset path, analysis goal description, or specification to estimate.


Project-Specific Context

Analysis Organisation

Scripts in scripts/R/09_analysis/ by approach:

  • 01_descriptive/ — Maps, scatter plots, Google Trends
  • 02_hedonic/ — Cross-sectional hedonic regressions
  • 03_repeat_sales/ — Repeat-transaction regressions
  • 04_long_difference/ — 250m grid-level long differences
  • 05_news/ — DiD and event studies with media coverage
  • 06_upstream_downstream/ — Directional spillover
  • 07_dry_spills/ — Dry spill analysis

Datasets

  • data/final/ — Analysis-ready datasets
  • data/processed/ — Intermediate pipeline outputs (parquet)
  • All data loaded via arrow::read_parquet() or arrow::open_dataset()

Output Destinations

  • Tables: output/tables/*.tex (modelsummary → LaTeX with tabularray)
  • Figures: output/figures/*.pdf or *.png
  • Regression objects: output/regs/*.rds
  • HTML interactive: output/html_plots/

Required R Conventions

  • here::here() for all paths
  • Native pipe |>
  • fixest::feols() for regressions with vcov = "hetero"
  • modelsummary for table output (tabularray format, [H] placement)
  • arrow for parquet I/O
  • snake_case naming
  • forcats::as_factor() for factors

Workflow

Step 1: Context Gathering

  1. Understand the analysis goal from $ARGUMENTS
  2. Read existing analysis scripts in the relevant subdirectory for patterns
  3. Read scripts/R/utils/spill_aggregation_utils.R if spill metrics are involved
  4. Check data/final/ for available datasets
  5. Read the relevant manuscript section in docs/overleaf/ if the analysis feeds into the paper

Step 2: Write Analysis Script

Follow the analysis script structure:

# ================================================================
# [Descriptive Title]
# Purpose: [What this script does]
# Inputs: [Data files]
# Outputs: [Figures, tables, RDS files]
# ================================================================

# === 1. Setup ============================================

library(tidyverse)
library(fixest)
library(modelsummary)
library(arrow)
library(here)

# === 2. Data Loading =====================================

df <- read_parquet(here("data", "final", "dataset.parquet"))

# === 3. Main Analysis ====================================

model <- feols(
  log_price ~ spill_count | lsoa + year_quarter,
  data = df,
  vcov = "hetero"
)

# === 4. Tables and Figures ================================

modelsummary(
  list("Main" = model),
  output = here("output", "tables", "table_name.tex"),
  fmt = 3
)

# === 5. Export ============================================

saveRDS(model, here("output", "regs", "model_name.rds"))

Step 3: Code Review

After writing the script, review it against the 9 categories from /review-r:

  • Script structure, console hygiene, reproducibility
  • Function design, figure quality, data persistence
  • Comments, error handling, polish

Fix any Critical or Major issues before presenting.

Step 4: Run the Script

If the user wants execution:

cd /Users/jacopoolivieri/Library/CloudStorage/Dropbox/01_projects/sewage
Rscript scripts/R/09_analysis/[subdir]/[script_name].R

Step 5: Present Results

  1. Results summary — Key estimates with SEs and economic interpretation
  2. Script created — Path and description
  3. Output files — Tables and figures generated
  4. Code review notes — Any conventions to flag
  5. TODO items — Missing data, additional specifications needed

Principles

  • Reproduce, don't guess. If a specific regression is requested, implement exactly that.
  • Strategy alignment. If an analysis feeds into a manuscript section, the code must implement what the paper claims.
  • Publication-ready output. Tables and figures should be directly includable in the paper.
  • Follow existing patterns. Read neighbouring scripts in the same subdirectory for style consistency.
  • Save everything. Every regression object saved as RDS, every table as LaTeX, every figure as PDF.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

a1

無料

VS-Enhanced Research Question Refiner - Prevents Mode Collapse and derives differentiated research questions Enhanced VS 3-Phase process: Modal question avoidance, alternatives presentation, differentiated RQ recommendation Use when: refining research ideas, formulating research questions, clarifying scope Triggers: research question, 연구 질문, PICO, SPIDER, research idea

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

a2

無料

VS-Enhanced Theoretical Framework Architect with Critique & Visualization Full VS 5-Phase process: Modal theory avoidance, Long-tail exploration, differentiated framework presentation Absorbed A3 (Devil's Advocate) critique and A6 (Conceptual Framework Visualizer) capabilities Use when: building theoretical foundations, designing conceptual models, deriving hypotheses, critiquing frameworks, visualizing models Triggers: theoretical framework, 이론적 프레임워크, conceptual model, 개념적 모형, hypothesis derivation, critique, devil's advocate, 반론, visualization, diagram

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

a5

無料

Agent A5 - Paradigm & Worldview Advisor - Philosophical foundations for research design. Covers ontology, epistemology, axiology, and methodology alignment. Use when: establishing philosophical foundations, justifying methodological choices, writing positionality statements Triggers: paradigm, 패러다임, ontology, epistemology, worldview, 세계관, philosophical foundations, 철학적 기초

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

Academic paper writing skill with 12-agent pipeline. v2.5: Style Calibration (learn author's writing voice from past papers) + Writing Quality Check (writing quality checklist for natural prose). Supports IMRaD, literature review, theoretical, case study, policy brief, and conference paper structures. APA 7.0 (default), Chicago, MLA, IEEE, Vancouver citation formats. Bilingual abstracts (zh-TW + EN). Multi-format output (LaTeX, DOCX, PDF, Markdown). Triggers on: write paper, academic paper, paper outline, write abstract, revise paper, check citations, convert to LaTeX, guide my paper, parse reviews, revision roadmap, 寫論文, 學術論文, 論文大綱, 寫摘要, 修改論文, 檢查引用, 引導我寫論文, 帶我規劃論文, 逐章規劃, 論文架構, 審查意見, 修訂路線圖.

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

Systematic writing framework for philosophy and interdisciplinary academic papers from optimized outline to submission-ready manuscript. Use when users want to: (1) write a paper from a detailed outline, (2) ensure quality control during writing, (3) maintain consistency across chapters, (4) prepare a submission-ready manuscript, or (5) systematically execute a planned paper. Triggered by phrases like 'write the paper from this outline,' 'compose the full manuscript,' 'execute the outline,' or when users have completed strategic planning (academic-paper-strategist skill) and are ready to write. Takes optimized outline as input; outputs complete manuscript with iterative quality checks.

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

Multi-perspective academic paper review with dynamic reviewer personas. Simulates 5 independent reviewers (EIC + 3 peer reviewers + Devil's Advocate) with field-specific expertise. Supports full review, re-review (verification), quick assessment, methodology focus, and Socratic guided modes. Triggers on: review paper, peer review, manuscript review, referee report, review my paper, critique paper, simulate review, editorial review.

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

brycewang-stanford のスキルをすべて見る

このスキルの問題を報告する