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

ols-regression

Econometrics skill for OLS regression and linear models. Activates when the user asks about: "run OLS", "linear regression", "ordinary least squares", "interpret regression results", "heteroskedasticity", "multicollinearity", "regression assumptions", "robust standard errors", "GLS", "WLS", "fit a regression model", "check regression diagnostics", "OLS假设", "最小二乘法", "线性回归", "回归系数", "残差检验", "异方差", "多重共线性", "普通最小二乘", "稳健标准误", "回归诊断"

インストール方法を見る

含まれるファイル(2)

  • SKILL.md4.8 KB
  • references/ols-reference.md5.1 KB

SKILL.md(原文)

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

OLS Regression Skill

This skill provides comprehensive guidance for OLS regression and linear models in empirical research. It covers model specification, assumption testing, diagnostic checks, and result interpretation, with code examples in Python, R, and Stata.

Core Workflow

When assisting with OLS regression, follow this sequence:

  1. Clarify the research question and data — understand dependent variable, key regressors, and sample
  2. Specify the model — choose functional form, control variables, fixed effects if needed
  3. Run the regression — provide code in the user's preferred language
  4. Check assumptions — run diagnostics systematically (see references)
  5. Interpret and report — explain coefficients, significance, fit, and caveats

Key Concepts

Model Specification

  • Write the regression equation explicitly: Y = β₀ + β₁X₁ + ... + βₖXₖ + ε
  • Consider log transformations for skewed variables or elasticity interpretation
  • Include relevant controls to reduce omitted variable bias
  • Watch for irrelevant variables inflating standard errors

The Gauss-Markov Assumptions

  1. Linearity in parameters
  2. Random sampling
  3. No perfect multicollinearity
  4. Zero conditional mean of errors: E(ε|X) = 0
  5. Homoskedasticity: Var(ε|X) = σ²
  6. (For inference) Normally distributed errors

Violation of assumptions 4–5 does not bias OLS but affects standard errors. Violation of assumption 4 (endogeneity) biases estimates — recommend IV methods.

Standard Error Options

  • Default OLS SE: valid only under homoskedasticity
  • HC robust SE (White): use when heteroskedasticity is suspected; always safe for cross-section data
  • Clustered SE: use when observations are grouped (e.g., by firm, region, year)
  • Newey-West SE: use for time series with autocorrelation

Quick Code Templates

Python (statsmodels)

import statsmodels.api as sm
import statsmodels.formula.api as smf

# With robust standard errors
model = smf.ols('y ~ x1 + x2 + x3', data=df).fit(cov_type='HC3')
print(model.summary())

R

library(lmtest)
library(sandwich)

model <- lm(y ~ x1 + x2 + x3, data = df)
coeftest(model, vcov = vcovHC(model, type = "HC3"))

Stata

reg y x1 x2 x3, robust

Diagnostics Checklist

Run all diagnostics after fitting. See references/ols-reference.md for full test details.

IssueTestQuick Fix
HeteroskedasticityBreusch-Pagan, White testRobust SE
AutocorrelationDurbin-Watson, Breusch-GodfreyNewey-West SE
MulticollinearityVIF > 10Drop/combine variables
Non-normality of errorsJarque-BeraCheck outliers; large N mitigates
Omitted variable biasRamsey RESETRespecify model

Reporting Standards (Academic)

  • Report coefficients with standard errors in parentheses (or t-stats)
  • Use asterisks for significance: * p<0.10, ** p<0.05, *** p<0.01
  • Always state which standard errors are used (robust, clustered, etc.)
  • Report R², adjusted R², N, and F-statistic
  • Describe the identification strategy and potential endogeneity concerns

For detailed test formulas, code, and extended examples, see references/ols-reference.md.

Common Pitfalls

  • Claiming causality without identification: OLS with controls does not establish causality — use IV, DID, or RDD for causal claims
  • Using default SE with clustered data: Always cluster SE at the group level when observations are grouped
  • Including "bad controls": Don't control for post-treatment variables (mediators) — they introduce collider bias
  • Log-transforming variables with zeros: ln(0) is undefined; use asinh(x) or ln(x+1) with appropriate interpretation
  • Reporting R² as evidence of a good model: High R² does not mean the model is correctly specified or causal

Related Skills & Commands

  • panel-data: If your data has repeated observations on the same units
  • iv-estimation: If you suspect endogeneity in your key regressor
  • stats: Generate summary statistics before running regressions
  • /diagnose: Run comprehensive diagnostic tests on your OLS model
  • /robustness: Design robustness checks for your specifications
  • /interpret: Get help interpreting regression output
  • table: Format regression results for publication

レビュー

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

同じリポジトリのスキル

概要と使いどころ

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,5982026年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,5982026年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,5982026年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,5982026年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,5982026年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,5982026年10月12日 更新

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

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