Skip to content

Commit 06acb3f

Browse files
committed
Update ex_P03_Panel-capital_strucuture.md
1 parent e95fa1b commit 06acb3f

1 file changed

Lines changed: 21 additions & 25 deletions

File tree

homework/ex_P03_Panel-capital_strucuture.md

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,8 @@ $$Lev_{it} = \alpha_i + \beta \cdot NPR_{it} + \theta \cdot m2\_growth_t + \bold
225225

226226
```stata
227227
* 安装包(如未安装)
228-
* net install regife, from("https://github.com/matthieugomez/regife.jl")
228+
* ssc install regife, replace
229229
* 注:regife 为 Stata 外部命令,具体安装方式请参考课堂讲义
230-
231-
regife lev npr m2_growth size tang growth ndts, ///
232-
id(stkcd) time(year) ///
233-
factors(f, rank(2)) ///
234-
vce(robust)
235230
```
236231

237232
**与 M1 的比较**
@@ -286,37 +281,28 @@ reghdfe lev npr npr_soe soe size tang growth ndts, ///
286281

287282
#### 模型 M4:时变系数模型
288283

289-
允许 $\beta$ 随年度变化,检验 NPR-Lev 关系的时序稳定性:
284+
允许 $\beta$ 随年度变化,检验 NPR-Lev 关系的时序稳定性:(Note: 以下代码只是示例,可能有误,具体实现可能需要根据实际数据结构调整)
290285

291-
**方法一**:逐年交互项
292286

293287
$$Lev_{it} = \alpha_i + \sum_{t=2010}^{2025} \beta_t \cdot (NPR_{it} \times \mathbf{1}[Year=t]) + \boldsymbol{\gamma}' \boldsymbol{X}_{it} + \varepsilon_{it}$$
294288

295289
```stata
296-
* 生成年度虚拟变量与 NPR 的交互项
297-
forvalues y = 2010/2025 {
298-
gen npr_y`y' = npr * (year == `y')
299-
}
300-
301-
reghdfe lev npr_y2010-npr_y2025 size tang growth ndts, ///
290+
reghdfe lev i.year#c.npr size tang growth ndts, ///
302291
absorb(stkcd year) vce(cluster stkcd year)
303292
304293
* 提取各年系数和置信区间,绘制时序图
305-
coefplot, keep(npr_y*) vertical ///
306-
yline(0) xlabel(, angle(45)) ///
307-
title("NPR 对 Lev 影响的时序变化(β_t)")
308-
```
294+
coefplot, ……
309295
310-
**方法二**:允许所有系数随时间变化(`xtplfc` 实现)
296+
* 绘图
297+
margins, dydx(npr) at(year=(2010(1)2025)) ……
311298
312-
参考课堂讲义(第 29 章),将 $Year$ 作为调节变量:
313-
314-
$$Lev_{it} = \alpha_i + \beta(Year_t) \cdot NPR_{it} + \boldsymbol{\gamma}(Year_t)' \boldsymbol{X}_{it} + \varepsilon_{it}$$
299+
marginsplot, ……
300+
```
315301

316302
**呈现要求**
317303

318304
- 绘制 $\hat{\beta}_t$ 的时序图,加入 95% 置信区间(error band)
319-
- 在图中标注重要宏观事件(2015 年股灾、2018 年中美贸易摩擦、2020 年 COVID-19、2022 年经济下行)
305+
- (可选) 在图中标注重要宏观事件(2015 年股灾、2018 年中美贸易摩擦、2020 年 COVID-19、2022 年经济下行)
320306
- 讨论:NPR-Lev 关系是否发生了结构性变化?转折点大约在哪一年?
321307

322308
#### 模型 M5:函数系数模型(非线性调节效应)
@@ -343,7 +329,17 @@ margins, dydx(npr) at(size=(20(1)30))
343329
marginsplot, title("β(Size):NPR 对 Lev 的边际效应随企业规模变化")
344330
```
345331

346-
**方法二**:样条函数系数模型(`xtplfc`
332+
**方法二**:样条函数系数模型(`xtplfc`)(可选)
333+
334+
该命令的早期版本只支持平衡面板,最新版本已支持非平衡面板。请根据实际数据情况选择使用。
335+
336+
最新版本需要手动下载并安装:<https://gitee.com/kerrydu/xtplfc_Stata/>
337+
338+
```stata
339+
net install xtplfc, from("https://gitee.com/kerrydu/xtplfc_Stata/raw/master/") replace
340+
```
341+
342+
上述新版命令无法执行,可以使用 `ssc install xtplfc, replace` 安装旧版,进而使用 `xtbalance` 将数据转换为平衡面板后运行。
347343

348344
参考课堂讲义(第 29、30 章),使用 `xtplfc` 命令,以 $Size$ 为平滑变量估计非参数形式的 $\beta(Size)$:
349345

@@ -373,7 +369,7 @@ $$Lev_{it} = \alpha_i + \beta_1 NPR_{it} \cdot \mathbf{1}[Size_{it} \leq \hat{\g
373369
```stata
374370
* 安装包(如未安装)
375371
* ssc install xtbalance
376-
* ssc install xthreg
372+
* findit xthreg // 然后根据提示安装
377373
378374
* 转换为平衡面板
379375
xtbalance, range(2010 2025)

0 commit comments

Comments
 (0)