Install the "stata-accounting-research" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/finance/stata-accounting-research into .claude/skills/stata-accounting-research/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "stata-accounting-research", then confirm the skill loads.
Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
Type this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
skills CLI
$ npx skills add wentorai/research-plugins --skill stata-accounting-research -a codex
Project install goes to .agents/skills/; add -g for ~/.codex/skills/.
Install the "stata-accounting-research" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/finance/stata-accounting-research into .agents/skills/stata-accounting-research/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "stata-accounting-research", then confirm the skill loads.
Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
skills CLI
$ npx skills add wentorai/research-plugins --skill stata-accounting-research -a cursor
Project install goes to .agents/skills/; add -g for ~/.cursor/skills/.
Install the "stata-accounting-research" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/finance/stata-accounting-research into .cursor/skills/stata-accounting-research/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "stata-accounting-research", then confirm the skill loads.
Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
skills CLI
$ npx skills add wentorai/research-plugins --skill stata-accounting-research -a gemini-cli
Project install goes to .agents/skills/; add -g for ~/.gemini/skills/.
Install the "stata-accounting-research" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/finance/stata-accounting-research into .gemini/skills/stata-accounting-research/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "stata-accounting-research", then confirm the skill loads.
Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
Installs for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
skills CLI
$ npx skills add wentorai/research-plugins --skill stata-accounting-research -a github-copilot
Project install goes to .agents/skills/; add -g for ~/.copilot/skills/.
Install the "stata-accounting-research" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/finance/stata-accounting-research into .github/skills/stata-accounting-research/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "stata-accounting-research", then confirm the skill loads.
GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
skills CLI
$ npx skills add wentorai/research-plugins --skill stata-accounting-research -a opencode
OpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
Install the "stata-accounting-research" agent skill from https://github.com/wentorai/research-plugins/tree/main/skills/domains/finance/stata-accounting-research into .opencode/skills/stata-accounting-research/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "stata-accounting-research", then confirm the skill loads.
OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
Facts
Skill name
stata-accounting-research
GitHub stars
298
Used in
1 other repo
Token cost
~4k tokens
SKILL.md length
421 words
Files
1
Skills in repo
405
Repo updated
First seen
Licence
MIT
At a glance
STATA code patterns for empirical accounting and finance research
Tasks that involve Econometrics and empirical research
SKILL.md covers Overview, Data Preparation, Earnings Quality Models and Earnings Management Detection, plus 7 more sections
Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
Tasks that involve Accounting and bookkeeping
What it does
Stata Accounting Research is an agent skill from wentorai/research-plugins. STATA code patterns for empirical accounting and finance research
Its SKILL.md is about 4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Business, Finance & HR, covering Econometrics and empirical research and Accounting and bookkeeping. The repository describes itself as: 350+ academic research skills, MCP configs, and plugins for Research-Claw and AI agents. The licence is MIT.
When your agent uses it
Tasks that involve Econometrics and empirical research
Tasks that involve Accounting and bookkeeping
Example prompts
“/stata-accounting-research”
What it can do on your machine
Read from SKILL.md and the folder at commit bf44b3c. It shows what the files ask for, not the result of running them.
Tool permissions
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Runs code
No scripts in the folder and no shell commands in SKILL.md (its code samples are stata).
From the folder's file list and the shell code blocks in SKILL.md.
Network
Links to these hosts (documentation or services it may open):
wrds-www.wharton.upenn.edu
github.com
From URLs in SKILL.md, links to its own repository left out.
Credentials
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Context cost
Stata Accounting Research loads about 4k tokens when it runs. Until then it costs about 23 tokens; SKILL.md has 421 words of instructions outside code blocks.
Always· name and description, kept in context so the agent knows when to use it
~23
When it runs· the whole SKILL.md, loaded when a task matches
~4k
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
Safety
Auto-check passed
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
Download SKILL.mdSave it as .claude/skills/stata-accounting-research/SKILL.md (or your agent's skills folder).
name
stata-accounting-research
description
STATA code patterns for empirical accounting and finance research
STATA Accounting Research Guide
Overview
Empirical accounting research relies heavily on STATA for data manipulation, statistical analysis, and robustness testing. The field has developed standardized methodological approaches -- earnings quality models, event studies, difference-in-differences for regulatory changes, and instrument variable strategies for endogeneity -- that are implemented in a relatively stable set of STATA patterns.
This guide provides the core STATA code patterns used in top accounting journals (The Accounting Review, Journal of Accounting Research, Journal of Accounting and Economics, and Review of Accounting Studies). These patterns are drawn from commonly used research designs in financial reporting, auditing, tax, and managerial accounting research.
Whether you are estimating discretionary accruals, conducting an event study around an earnings announcement, testing the effect of auditor rotation on audit quality, or implementing a regulatory shock analysis, these patterns provide tested, reviewable STATA implementations.
Data Preparation
Loading and Cleaning COMPUSTAT Data
stata
* ============================================================
* COMPUSTAT Annual Data Preparation for Accounting Research
* Standard preparation used across most empirical accounting papers
* ============================================================
* Load COMPUSTAT annual data
use "compustat_annual.dta", clear
* Keep relevant variables
keep gvkey fyear datadate at sale cogs xsga dp ib oancf act lct che dlc ///
csho prcc_f ceq re dltt txp xrd ppegt ppent invt rect
* Set panel structure
destring gvkey, replace
xtset gvkey fyear
* --- Basic cleaning ---
* Drop financial firms (SIC 6000-6999) and utilities (SIC 4900-4999)
drop if inrange(sic, 6000, 6999) | inrange(sic, 4900, 4999)
* Require minimum observations
bysort gvkey: gen nobs = _N
drop if nobs < 3
drop nobs
* --- Generate common variables ---
* Total accruals (balance sheet approach)
gen total_accruals = (D.act - D.che) - (D.lct - D.dlc) - dp
* Total accruals (cash flow approach, preferred)
gen total_accruals_cf = ib - oancf
* Scale by lagged total assets
gen lag_at = L.at
gen ta_scaled = total_accruals_cf / lag_at
gen sale_scaled = sale / lag_at
gen ppe_scaled = ppent / lag_at
gen dsale = D.sale / lag_at
gen drec = D.rect / lag_at
gen roa = ib / lag_at
* Market value of equity
gen mve = csho * prcc_f
* Book-to-market ratio
gen btm = ceq / mve
* Leverage
gen leverage = (dlc + dltt) / at
* Firm size
gen size = ln(at)
* --- Winsorize at 1% and 99% ---
foreach var of varlist ta_scaled sale_scaled ppe_scaled roa btm leverage size {
winsor2 `var', replace cuts(1 99)
}
* Label variables
label var ta_scaled "Total accruals / lagged assets"
label var roa "Return on assets"
label var btm "Book-to-market ratio"
label var leverage "Total debt / total assets"
label var size "Log(total assets)"
save "compustat_clean.dta", replace
Earnings Quality Models
Modified Jones Model (Dechow et al., 1995)
stata
* ============================================================
* Modified Jones Model: Estimate discretionary accruals
* Standard model for earnings management research
* ============================================================
use "compustat_clean.dta", clear
* --- Step 1: Estimate non-discretionary accruals by industry-year ---
* Jones (1991) model estimated cross-sectionally
gen inv_lag_at = 1 / lag_at
gen dsale_drec = dsale - drec // Modified Jones adjustment
* Estimate by 2-digit SIC and year (require >= 15 obs per group)
gen sic2 = floor(sic / 100)
* Cross-sectional estimation
gen da_mj = .
gen nda_mj = .
levelsof fyear, local(years)
foreach y of local years {
levelsof sic2 if fyear == `y', local(industries)
foreach ind of local industries {
* Count observations in this industry-year
count if sic2 == `ind' & fyear == `y' & !missing(ta_scaled, inv_lag_at, dsale_drec, ppe_scaled)
if r(N) >= 15 {
* Estimate Jones model
quietly reg ta_scaled inv_lag_at dsale_drec ppe_scaled ///
if sic2 == `ind' & fyear == `y', robust
* Predict non-discretionary accruals
quietly predict temp_nda if sic2 == `ind' & fyear == `y', xb
quietly replace nda_mj = temp_nda if sic2 == `ind' & fyear == `y'
drop temp_nda
}
}
}
* Discretionary accruals = Total accruals - Non-discretionary accruals
replace da_mj = ta_scaled - nda_mj
* Absolute discretionary accruals (common measure of earnings quality)
gen abs_da = abs(da_mj)
label var da_mj "Discretionary accruals (Modified Jones)"
label var abs_da "Absolute discretionary accruals"
save "accruals_data.dta", replace
Performance-Matched Discretionary Accruals (Kothari et al., 2005)
stata
* ============================================================
* Kothari (2005): Performance-matched discretionary accruals
* Controls for correlation between performance and accruals
* ============================================================
* Add ROA to the Jones model
gen da_kothari = .
levelsof fyear, local(years)
foreach y of local years {
levelsof sic2 if fyear == `y', local(industries)
foreach ind of local industries {
count if sic2 == `ind' & fyear == `y' & !missing(ta_scaled, inv_lag_at, dsale_drec, ppe_scaled, roa)
if r(N) >= 15 {
quietly reg ta_scaled inv_lag_at dsale_drec ppe_scaled roa ///
if sic2 == `ind' & fyear == `y', robust
quietly predict temp_res if sic2 == `ind' & fyear == `y', residuals
quietly replace da_kothari = temp_res if sic2 == `ind' & fyear == `y'
drop temp_res
}
}
}
gen abs_da_kothari = abs(da_kothari)
label var da_kothari "Discretionary accruals (Kothari)"
label var abs_da_kothari "Absolute DA (Kothari)"
Earnings Management Detection
Earnings Distribution Discontinuity (Burgstahler & Dichev 1997)
stata
* 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
Real Earnings Management (Roychowdhury 2006)
stata
* 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
}
}
}
Instrumental Variables (Two-Stage Least Squares)
stata
* IV regression for endogeneity concerns
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
Event Study
stata
* ============================================================
* Short-window event study around earnings announcements
* Standard methodology for capital markets research
* ============================================================
use "crsp_daily_returns.dta", clear
* Merge with event dates
merge m:1 gvkey fyear using "earnings_dates.dta", keep(match) nogen
* --- Estimation window: [-250, -30] relative to announcement ---
gen event_day = date - rdq // rdq = report date of quarterly earnings
keep if inrange(event_day, -250, 10)
* Estimate market model in estimation window
gen est_window = inrange(event_day, -250, -30)
gen event_window = inrange(event_day, -1, 1) // 3-day window [-1, +1]
* Market model: R_i = alpha + beta * R_m + epsilon
bysort permno fyear: egen has_enough = total(est_window)
keep if has_enough >= 100 // Require 100+ days in estimation window
* Estimate market model parameters
gen alpha = .
gen beta_mkt = .
levelsof permno, local(firms)
foreach p of local firms {
capture quietly reg ret mktrf if permno == `p' & est_window == 1
if _rc == 0 {
quietly replace alpha = _b[_cons] if permno == `p'
quietly replace beta_mkt = _b[mktrf] if permno == `p'
}
}
* Abnormal returns
gen ar = ret - (alpha + beta_mkt * mktrf)
* Cumulative abnormal returns [-1, +1]
bysort permno fyear (event_day): egen car_3day = total(ar) if event_window == 1
* Cross-sectional test
preserve
keep if event_day == 0
* t-test: Is average CAR different from zero?
ttest car_3day == 0
* Regression with controls
reg car_3day surprise size btm, robust
restore
Regression Specifications
Standard Panel Regression with Fixed Effects
stata
* ============================================================
* Standard regression specification for accounting research
* Includes firm and year fixed effects, clustered standard errors
* ============================================================
use "merged_analysis_data.dta", clear
* --- Main specification ---
* DV: Absolute discretionary accruals (earnings quality)
* Key IV: Big 4 auditor indicator
* Model 1: Pooled OLS (baseline, for comparison only)
reg abs_da big4 size leverage btm roa loss, robust
estimates store m1
* Model 2: Year fixed effects
reg abs_da big4 size leverage btm roa loss i.fyear, robust
estimates store m2
* Model 3: Industry + Year fixed effects
reg abs_da big4 size leverage btm roa loss i.sic2 i.fyear, robust
estimates store m3
* Model 4: Firm + Year fixed effects (preferred specification)
reghdfe abs_da big4 size leverage btm roa loss, absorb(gvkey fyear) ///
cluster(gvkey)
estimates store m4
* Model 5: Firm + Year FE, two-way clustering (firm and year)
reghdfe abs_da big4 size leverage btm roa loss, absorb(gvkey fyear) ///
cluster(gvkey fyear)
estimates store m5
* --- Output table ---
esttab m1 m2 m3 m4 m5 using "table_main.tex", replace ///
star(* 0.10 ** 0.05 *** 0.01) ///
b(%9.4f) se(%9.4f) ///
stats(N r2 r2_a, fmt(%9.0g %9.4f %9.4f) ///
labels("Observations" "R-squared" "Adj. R-squared")) ///
title("Effect of Auditor Type on Earnings Quality") ///
label booktabs
Robustness Tests
Propensity Score Matching
stata
* ============================================================
* Propensity Score Matching (PSM) for endogeneity concerns
* Used when treatment assignment (e.g., Big 4 auditor) is not random
* ============================================================
* Step 1: Estimate propensity score
logit big4 size leverage btm roa loss age_firm, robust
predict pscore, pr
* Step 2: Common support check
gen cs = pscore >= 0.1 & pscore <= 0.9 // Trim extreme propensity scores
* Step 3: Nearest-neighbor matching (1:1, without replacement)
psmatch2 big4 size leverage btm roa loss if cs == 1, ///
outcome(abs_da) neighbor(1) caliper(0.01) common
* Check covariate balance after matching
pstest size leverage btm roa loss, both
* Step 4: Re-estimate on matched sample
gen matched = _weight != .
reg abs_da big4 size leverage btm roa loss if matched == 1, robust
Always cluster standard errors by firm (at minimum) in panel data. Two-way clustering by firm and year is increasingly required by reviewers.
Use reghdfe for high-dimensional fixed effects. It is faster and more memory-efficient than areg or xtreg, fe.
Report economic magnitude. A one-standard-deviation change in X produces a Y% change in the dependent variable.
Include all robustness tests that reviewers expect: PSM, Heckman, placebo tests, entropy balancing, and alternative variable definitions.
Winsorize at 1% and 99% as a default; report results at 5%/95% as a robustness check.
Use eststo and esttab for consistent, automated table generation. Never hand-type regression results.
Show full SKILL.md (118 more words)Show less
References
Dechow, P. M., Sloan, R. G., & Sweeney, A. P. (1995). Detecting Earnings Management. The Accounting Review, 70(2), 193-225.
Kothari, S. P., Leone, A. J., & Wasley, C. E. (2005). Performance Matched Discretionary Accrual Measures. Journal of Accounting and Economics, 39(1), 163-197.
Roychowdhury, S. (2006). Earnings Management through Real Activities Manipulation. Journal of Accounting and Economics, 42(3), 335-370.
Burgstahler, D., & Dichev, I. (1997). Earnings Management to Avoid Earnings Decreases and Losses. Journal of Accounting and Economics, 24(1), 99-126.
Gow, I. D., Ormazabal, G., & Taylor, D. J. (2010). Correcting for Cross-Sectional and Time-Series Dependence in Accounting Research. The Accounting Review, 85(2), 483-512.
We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in wentorai/research-plugins, which our catalogue first saw on October 7, 2026.
Stata Accounting Research next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
Stata Accounting Research compared with similar skills
Skill
Stars
Used in
Tokens
Auto-check
Licence
Repo updated
Stata Accounting Research this skillwentorai/research-plugins
A skill your agent uses when deciding which English economics / finance / management / accounting / marketing / operations / information-systems journal skill to invoke next, comparing fit across…
A skill your agent uses when research design and identification are the bottleneck for a Review of Accounting Studies (RAST) manuscript — choosing the setting, shock, and design that credibly…
Infer integer allele-specific copy number, tumor purity, and ploidy from tumor sequencing by jointly modeling read depth (logR) and B-allele frequency (BAF) with ASCAT, Sequenza, FACETS, PURPLE, and…
Detect somatic and germline copy number variants from targeted, exome, and whole-genome sequencing with CNVkit, a read-depth caller that combines on-target and off-target (antitarget) coverage.
STATA code patterns for empirical accounting and finance research. Stata Accounting Research is an agent skill from wentorai/research-plugins.
When should I use Stata Accounting Research?
Stata Accounting Research fits situations like: tasks that involve Econometrics and empirical research; tasks that involve Accounting and bookkeeping.
How do I install Stata Accounting Research in Claude Code?
Run `npx skills add wentorai/research-plugins --skill stata-accounting-research -a claude-code`. Or copy the skill folder (skills/domains/finance/stata-accounting-research in wentorai/research-plugins) into .claude/skills/stata-accounting-research in your project. Claude Code loads it when a task matches its description.
How do I install Stata Accounting Research in Codex?
Run `npx skills add wentorai/research-plugins --skill stata-accounting-research -a codex`. Or copy the skill folder (skills/domains/finance/stata-accounting-research in wentorai/research-plugins) into .agents/skills/stata-accounting-research in your project. Codex loads it when a task matches its description.
Can I use Stata Accounting Research in Cursor, Gemini CLI or GitHub Copilot?
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wentorai/research-plugins --skill stata-accounting-research -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/stata-accounting-research, .gemini/skills/stata-accounting-research, .github/skills/stata-accounting-research and .opencode/skills/stata-accounting-research in your project.
What does Stata Accounting Research need to run?
SKILL.md names no scripts, command-line tools or credentials: Stata Accounting Research is instructions for the agent only.
Does Stata Accounting Research access the network?
SKILL.md names 2 domains. As links in the text: wrds-www.wharton.upenn.edu and github.com. This is read from the text; nothing was executed.
Is Stata Accounting Research safe to install?
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
What licence does Stata Accounting Research use?
Stata Accounting Research is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
How many tokens does Stata Accounting Research use?
About 4k tokens (SKILL.md is roughly 16k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
What are the alternatives to Stata Accounting Research?
Skills that share tags, products or a category with Stata Accounting Research: En Journal Workflow (franklee16/academic-research-skills, 223 stars), Revacc Methods (brycewang-stanford/Awesome-Journal-Skills, 1.2k stars), Workflow Orchestration (AnastasiyaW/codex-claude-code-config, 154 stars) and Stata Accounting Research (brycewang-stanford/Auto-Empirical-Research-Skills, 4.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
Who maintains Stata Accounting Research?
wentorai (a GitHub user) maintains it in wentorai/research-plugins, which has 298 GitHub stars. The repository holds 405 skills in this directory. The repository was last updated on June 19, 2026.
Source: wentorai/research-plugins on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.