首页 > 解决方案 > 如何使用 pgmm 估计此回归?R

问题描述

我有很多关于厄瓜多尔公司的数据,我想从 Cobb Douglas 函数和 Trans-Log 生产函数估计 Solows Residual。

其中 x_1 是 K,x_2 是 l,x_3 是 m。

科布道格拉斯生产函数

在此处输入图像描述

所以使用矩的广义方法,使用Stata我可以运行这个命令:

xtabond y k l m, vce(robust) twostep

对数产生函数

在此处输入图像描述

所以使用矩的广义方法,使用Stata我可以运行这个命令:

xtabond y K l m K2 l2 m2 Kl lm Km Klm, vce(robust) twostep

然后,我predict epsilon,e在 Stata 中使用并获得每个公司的 Solow 残差(全要素生产率)。

如何用 R 复制这些回归?

我在这里有一些例子:https ://www.rdocumentation.org/packages/plm/versions/1.6-5/topics/pgmm

示例在哪里:

data("EmplUK", package = "plm")
z1 <- pgmm(log(emp) ~ lag(log(emp), 1:2) + lag(log(wage), 0:1)
           + log(capital) + lag(log(output), 0:1) | lag(log(emp), 2:99),
            data = EmplUK, effect = "twoways", model = "twosteps")
summary(z1)

数据的一个小样本在这里:(数据在厄瓜多尔公司的监管部门是公开的)

Year           ID        y        K        l        m
1  2012 190003450001 14.88396 14.44521     -Inf 15.55542
2  2013 190003450001 14.75213 14.27624     -Inf 15.38952
3  2014 190003450001 14.40326 14.16379 11.90361 14.26435
4  2015 190003450001 14.39052 14.27086 11.84461 14.26571
5  2012 190001628001 15.96092 15.97506     -Inf 16.81104
6  2013 190001628001 16.01222 16.15912     -Inf 16.74723
7  2014 190001628001     -Inf     -Inf     -Inf     -Inf
8  2015 190001628001 16.46026 16.31453 13.29808 16.14763
9  2016 190001628001 15.76267 16.04522 13.27426 15.35239
10 2017 190001628001 15.82032 16.31170 13.38172 15.66665
11 2018 190001628001     -Inf 16.39619     -Inf     -Inf
12 2019 190001628001     -Inf     -Inf     -Inf     -Inf
13 2012 190001237001 14.20458 14.86121 10.45178 13.30889
14 2013 190001237001 14.17424 14.76980 10.60879 13.20741
15 2014 190001237001 14.16360 14.76997 11.23519 12.27956
16 2015 190001237001     -Inf 14.70894 11.32352 12.09503
17 2016 190001237001     -Inf 14.65192 11.21588 12.04216
18 2017 190001237001     -Inf 14.73558 11.22156 12.06880
19 2018 190001237001 10.70109 14.79774 11.38213 12.19772
20 2019 190001237001 11.27462 14.79577 11.43471 12.30889
21 2012 190000702001 14.20983 14.50985     -Inf 14.94456
22 2013 190000702001 14.21965 14.56814 11.57245 15.07741
23 2014 190000702001 14.14572 14.59562 11.94087 13.64583
24 2015 190000702001 14.12597 14.45484 11.94285 13.57494
25 2016 190000702001 13.75251 14.40140 11.80791 13.18838
26 2017 190000702001 13.62060 14.42819 11.69652 13.08202
27 2018 190000702001 13.66099 14.45962 11.74105 13.06012
28 2019 190000702001 13.37813 14.23365 11.71154 12.74455
29 2012 190002071001 15.12061 16.95941 11.42580 15.65267
30 2013 190002071001 14.92227 16.89518 11.48729 15.67180
31 2014 190002071001 14.88963 16.79254 12.51389      NaN
32 2015 190002071001 15.05236 16.78926 12.62048 10.53592
33 2016 190002071001 14.80011 16.97871 12.57244 12.57454
34 2017 190002071001 14.87147 16.97710 12.64150 12.49348
35 2018 190002071001       NA       NA       NA       NA
36 2019 190002071001       NA       NA       NA       NA
37 2012 190001849001 15.05430 16.17834 10.89152 15.53571
38 2013 190001849001 15.15008 16.18699 11.12873 15.67056
39 2014 190001849001 15.15201 16.13936 12.26228 14.39855
40 2015 190001849001 15.06341 16.14173 12.31668 14.17148

标签: rstatisticsregressionplmeconomics

解决方案


推荐阅读