跳到主要内容
知仓学习社ZHICANG

Significance-Search

|

不碰外部(只输出文字)无严重或高危命中brycewang-stanford/Auto-Empirical-Research-Skills

它会碰到什么

扫了多少1 个文本文件,4 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Control Variable Search Skill

This skill generates a parallelised Stata .do file that:

  1. Enumerates all subsets of optional control variables via tuples
  2. Runs reghdfe (or user-specified command) for each combination across N parallel Stata instances
  3. Ranks combinations by |t| of the independent variable
  4. Reports Top 10 and runs the best combination regression

Important: This skill only generates the .do file. It does NOT execute it. Tell the user the output path and let them run it in Stata themselves.

What to collect from the user

Ask the user for the following. Items marked (required) must be provided; others have defaults.

| Parameter | Description | Default |

|---|---|---|

| data file (required) | Full path to the .dta file | -- |

| dependent variable (Y) (required) | Y variable name | -- |

| independent variable (X) (required) | X variable of interest | -- |

| cluster variable (required) | Variable for clustering SE and fixed effects | -- |

| mandatory controls (required) | Controls always included | -- |

| optional controls (required) | Controls to search over (all subsets) | -- |

| N_WORKERS | Number of parallel Stata instances | 8 |

| significance level | Two-tailed alpha | 0.01 |

| model command | Estimation command | reghdfe |

| absorb | Fixed effects specification | absorb(<<CLUSTER>> year) |

| vce | Variance-covariance specification | vce(cluster <<CLUSTER>>) |

| STATA_EXE | Path to Stata executable | E:\Stata\StataMP-64.exe |

Critical constraints

  • Optional controls must be <= 14 variables. With 15+ variables, tuples generates 32,768+ combinations

and will freeze Stata. If the user provides more than 14, warn them and ask them to reduce or move

some into mandatory controls.

  • The output .do file path is <data_dir>\控制变量搜索_并行.do by default, placed next to the data file.

How to generate

After collecting parameters:

  1. Read the template at C:\Users\Verasuna\.claude\skills\ControlVariable\template.do
  2. Replace all <<PLACEHOLDERS>> with user-provided values (see table below)
  3. Write the result to <data_dir>\控制变量搜索_并行.do
  4. Do NOT execute it. Tell the user: "do文件已生成至 <path>,请在Stata中手动运行。"

Do not modify any code logic in the template. Only replace placeholders.

Placeholder reference

<<N_WORKERS>>          e.g. 8
<<STATA_EXE>>          e.g. E:\Stata\StataMP-64.exe
<<PROJ_DIR>>           directory containing the .dta file
<<DATA_FILE>>          filename of .dta (just the name, not full path)
<<SIGNIFICANCE>>       e.g. 0.01
<<DEP_VAR>>            dependent variable (Y)
<<INDEP_VAR>>          independent variable (X)
<<MANDATORY_CONTROLS>> space-separated mandatory controls
<<OPTIONAL_CONTROLS>>  space-separated optional controls
<<MODEL_CMD>>          e.g. reghdfe
<<MODEL_ABSORB>>       e.g. absorb(stkcd year)
<<MODEL_VCE>>          e.g. vce(cluster stkcd)
<<HEARTBEAT_STALL>>    300

Typical usage

User says: "Y是GTFPEFF8,X是Size,聚类到stkcd,必选控制变量Lev,可选控制变量ROA ROE ATO Cashflow,数据文件是 C:\data\mydata.dta"

Then fill:

  • <<DEP_VAR>> = GTFPEFF8
  • <<INDEP_VAR>> = Size
  • <<MODEL_ABSORB>> = absorb(stkcd year)
  • <<MODEL_VCE>> = vce(cluster stkcd)
  • <<MANDATORY_CONTROLS>> = Lev
  • <<OPTIONAL_CONTROLS>> = ROA ROE ATO Cashflow
  • <<PROJ_DIR>> = C:\data
  • <<DATA_FILE>> = mydata.dta
  • Other placeholders use defaults

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。