원클릭으로
stata-accounting-guide
STATA code for empirical accounting and financial economics research
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
STATA code for empirical accounting and financial economics research
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Route empirical-research requests through the Auto-Empirical Research Skills catalog when this whole repository is installed as one skill in Codex, CodeBuddy, Claude Code, or another IDE. Use to choose and load the right vendored AERS skill for causal inference, econometrics, replication, data acquisition, manuscript writing, peer review and referee responses, citation checking, de-AIGC editing, or full empirical-paper workflows without reading the entire repository at once.
公司金融实证研究的"漏斗式选题查找器"。互动开场先后询问 (1) 研究方向、(2) 候选标题数量 N, 再扫描全球文献(已出版英文学术期刊 + SSRN working paper + 全球高校 department seminar 1 年内日程),基于 Edmans (2024) "1000 Rejections" 红线生成 N 个候选标题,**通过并行 subagent(Agent 工具)批量生成计划书 + 查新;每个 subagent 必须强制调用 Skill 工具加载 econfin-proposal 与 novelty-check 两个预设 skill 完成各自模块**,**只有当 novelty score >= 9 时(即 JF/JFE/RFS 顶刊层次),subagent 才把 proposal + 查新报告合并的 md 写入 F:\Dropbox\CC\选题大全\<研究方向短名>\(以"简短选题名称-分数"命名,子文件夹名由 Step 0 从用户输入的研究方向派生);< 9 分的选题在 subagent 内部直接丢弃,绝不写盘、绝不输出**。当用户说"找选题"、"帮我找选题"、"想做 X 方向"、 "empirical CF idea search"、"批量生成研究计划书"、"100 ideas"、"econfin-idea-finder" 时触发。
Create and compile beautiful Beamer presentations following the Rhetoric of Decks philosophy. Use when making slides, creating decks, or compiling .tex presentation files.
Scaffold a new research project with standard directory structure, CLAUDE.md template, and documented README. Use this at the start of every new project to ensure consistent organization.
Download, split, and deeply read academic PDFs. Use when asked to read, review, or summarize an academic paper. Splits PDFs into 4-page chunks, reads them in small batches, and produces structured reading notes — avoiding context window crashes and shallow comprehension.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
| name | stata-accounting-guide |
| description | STATA code for empirical accounting and financial economics research |
| metadata | {"openclaw":{"emoji":"📒","category":"analysis","subcategory":"econometrics","keywords":["Stata","accounting research","Compustat","CRSP","earnings management","financial economics"],"source":"https://www.stata.com"}} |
Generate publication-ready Stata code for empirical accounting research. This skill covers the standard econometric models, variable constructions, and estimation procedures used in top accounting journals (TAR, JAR, JAE, RAS, CAR).
Empirical accounting research has developed a distinctive set of analytical conventions that differ from general econometrics. Researchers work with financial statement data from databases like Compustat and CRSP, construct standardized proxies for earnings quality, accruals, and discretionary behavior, and employ estimation techniques that address the particular endogeneity concerns in archival accounting studies.
This skill provides the Stata implementation for the most commonly used models in accounting research: accrual models (Jones, Modified Jones, performance-matched), earnings management detection, value relevance studies, audit quality analyses, and corporate governance research. Each model includes the variable construction from raw Compustat items, the estimation procedure, and the table formatting expected by accounting journal reviewers.
The code follows the conventions established in influential methodological papers by Dechow, Sloan, and Sweeney (1995), Kothari, Leone, and Wasley (2005), and Ecker, Francis, Kim, Olsson, and Schipper (2006), ensuring alignment with reviewer expectations at major accounting journals.
* ============================================
* Standard Compustat Variable Construction
* ============================================
* Load Compustat annual data
use "raw/compustat_annual.dta", clear
* Fiscal year identifier
gen fyear = year(datadate)
* Key financial variables (Compustat mnemonics)
* Total accruals (balance sheet approach)
gen total_accruals_bs = (dch_act - dch_che) - (dch_lct - dch_dlc - dch_txp) - dp
replace total_accruals_bs = total_accruals_bs / l.at // Scale by lagged assets
* Total accruals (cash flow approach, preferred)
gen total_accruals_cf = (ib - oancf) / l.at
* Key ratios
gen roa = ib / l.at // Return on assets
gen leverage = (dltt + dlc) / at // Financial leverage
gen size = ln(at) // Firm size (log assets)
gen mb = (prcc_f * csho) / ceq // Market-to-book
gen sales_growth = (sale - l.sale) / l.sale // Revenue growth
gen cfo = oancf / l.at // Cash flow from operations
gen loss = (ib < 0) // Loss indicator
* Industry classification (Fama-French 48)
merge m:1 sic using "reference/ff48_sic.dta", nogen keep(master match)
* Standard sample restrictions
drop if at <= 0 // Positive assets
drop if sale < 0 // Non-negative sales
drop if missing(ib, at, sale) // Key variables non-missing
drop if inlist(sic, 6000, 6999) // Exclude financials (SIC 6000-6999)
drop if inlist(sic, 4900, 4999) // Exclude utilities (SIC 4900-4999)
* Require minimum observations per industry-year
bysort ff48 fyear: gen n_iy = _N
drop if n_iy < 20
* Winsorize continuous variables at 1st/99th percentile
foreach var of varlist roa leverage mb sales_growth cfo total_accruals_cf {
winsor2 `var', cuts(1 99) replace
}
* ============================================
* Modified Jones Model - Industry-Year Estimation
* ============================================
* Construct regressors
gen inv_at = 1 / l.at
gen d_rev_rec = ((sale - l.sale) - (rect - l.rect)) / l.at
gen ppe_scaled = ppegt / l.at
* Estimate by industry-year cross-sections
gen da_mj = .
levelsof ff48, local(industries)
levelsof fyear, local(years)
foreach ind of local industries {
foreach yr of local years {
capture {
reg total_accruals_cf inv_at d_rev_rec ppe_scaled ///
if ff48 == `ind' & fyear == `yr', robust
predict resid if e(sample), resid
replace da_mj = resid if ff48 == `ind' & fyear == `yr' & !missing(resid)
drop resid
}
}
}
label variable da_mj "Discretionary accruals (Modified Jones)"
* Add ROA as control for performance matching
gen da_kothari = .
foreach ind of local industries {
foreach yr of local years {
capture {
reg total_accruals_cf inv_at d_rev_rec ppe_scaled roa ///
if ff48 == `ind' & fyear == `yr', robust
predict resid if e(sample), resid
replace da_kothari = resid if ff48 == `ind' & fyear == `yr' & !missing(resid)
drop resid
}
}
}
label variable da_kothari "Discretionary accruals (Kothari)"
* Alternative: performance matching by ROA decile
xtile roa_decile = roa, nq(10)
bysort ff48 fyear roa_decile: egen da_pm = mean(da_mj)
gen da_performance_matched = da_mj - da_pm
* ============================================
* Earnings Distribution Discontinuity Test
* ============================================
* Scaled earnings (earnings per share / price)
gen earn_scaled = ib / (prcc_f * csho)
* Histogram around zero
twoway (histogram earn_scaled if inrange(earn_scaled, -0.10, 0.10), ///
width(0.005) color(navy%50)), ///
xline(0, lcolor(red)) ///
title("Distribution of Scaled Earnings Around Zero") ///
xtitle("Earnings / Market Cap") ytitle("Frequency") ///
graphregion(color(white))
graph export "figures/earnings_discontinuity.pdf", replace
* Burgstahler & Dichev (1997) test
gen earn_bin = round(earn_scaled, 0.005)
tab earn_bin if inrange(earn_scaled, -0.025, 0.025)
* Test for discontinuity at zero
gen just_above = (earn_scaled >= 0 & earn_scaled < 0.005)
gen just_below = (earn_scaled >= -0.005 & earn_scaled < 0)
prtest just_above == just_below
* Abnormal cash flow from operations
gen da_cfo = .
foreach ind of local industries {
foreach yr of local years {
capture {
reg cfo inv_at sale_scaled d_sale_scaled ///
if ff48 == `ind' & fyear == `yr', robust
predict resid if e(sample), resid
replace da_cfo = resid if ff48 == `ind' & fyear == `yr' & !missing(resid)
drop resid
}
}
}
* Abnormal production costs
gen prod_costs = cogs + (xinv - l.xinv)
gen prod_scaled = prod_costs / l.at
gen da_prod = .
foreach ind of local industries {
foreach yr of local years {
capture {
reg prod_scaled inv_at sale_scaled d_sale_scaled l.d_sale_scaled ///
if ff48 == `ind' & fyear == `yr', robust
predict resid if e(sample), resid
replace da_prod = resid if ff48 == `ind' & fyear == `yr' & !missing(resid)
drop resid
}
}
}
* Main regression: Discretionary accruals on governance
reg abs_da_mj board_independence ceo_duality audit_committee_size ///
big4 size leverage mb loss i.fyear, cluster(gvkey)
estimates store gov1
reg abs_da_mj board_independence ceo_duality audit_committee_size ///
big4 inst_ownership analyst_following ///
size leverage mb loss i.fyear, cluster(gvkey)
estimates store gov2
* Publication table
esttab gov1 gov2 using "tables/governance_regression.tex", ///
b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) ///
label title("Corporate Governance and Earnings Quality") ///
mtitles("Baseline" "Extended") ///
drop(*.fyear) indicate("Year FE = *.fyear") ///
stats(N r2_a, labels("Observations" "Adj. R-squared") fmt(0 3)) ///
addnotes("Standard errors clustered by firm in parentheses.") ///
replace
* Instrumental variable regression
ivregress 2sls earnings_quality (board_independence = ///
state_governance_index peer_board_independence) ///
size leverage mb loss i.fyear, cluster(gvkey) first
* First-stage diagnostics
estat firststage
estat endogenous
* Weak instrument test
estat firststage, forcenonrobust
* PSM for treatment effect of Big 4 auditor
logit big4 size leverage mb roa loss i.ff48, robust
predict pscore, pr
* Nearest-neighbor matching
psmatch2 big4, pscore(pscore) outcome(abs_da_mj) ///
neighbor(3) caliper(0.01) common