全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
4152 3
2011-11-06
我看包里的例子有一个地方不太懂,比如z2 <- pgmm(log(emp) ~ lag(log(emp), 1)+ lag(log(wage), 0:1) +
        lag(log(capital), 0:1) | lag(log(emp), 2:99) +
        lag(log(wage), 2:99) + lag(log(capital), 2:99),
        data = EmplUK, effect = "twoways", model = "onestep",
         transformation = "ld")
summary(z2, robust = TRUE)


我不太懂命令中红色的部分,另外2:99的设定的根据是什么?


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2011-11-10 19:47:16
这个也是我很困惑的地方
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-11 20:52:08

这是在建构gmm instrument时用到的参数

为保险起见都会取大范围

譬如底下例子:

  2:8 与 2:99的结果是相同的

  这时的matrix 是 28 x 6

  而2:7时,与 2:99的结果就不相同

  这时的matrix 是 27 x 6

详见plm.pdf page 31/65

#########
y~lag(y, 1:2)+lag(x1, 0:1)+lag(x2, 0:2) | lag(y, 2:99)
is similar to y~lag(y,1:2)+lag(x1, 0:1)+lag(x2, 0:2) |
                lag(y, 2:99) | lag(x1, 0:1)+lag(x2,0:2)
and indicates that all lags from 2 of y is used as gmm instruments.

The first right-hand side part describe the covariates.
The second one, which is mandatory, describes the gmm instruments.
The third one, which is optionnal,describes the ’normal’ instruments.
  By default, all the variables of the model which are not used as
  GMM instruments are used as normal instruments with the same lag
  structure as the one specified in the model.


############
library(plm)
data("EmplUK", package = "plm")

z7 <- pgmm(log(emp) ~ lag(log(emp), 1)+ lag(log(wage), 0:1) +
lag(log(capital), 0:1) | lag(log(emp), 2:7) +
lag(log(wage), 2:7) + lag(log(capital), 2:7),
data = EmplUK, effect = "twoways", model = "onestep",
transformation = "ld")
summary(z7)
Coefficients
                         Estimate Std. Error z-value  Pr(>|z|)   
lag(log(emp), 1)         0.936845   0.016543 56.6313 < 2.2e-16 ***
lag(log(wage), 0:1)0    -0.627037   0.069777 -8.9863 < 2.2e-16 ***
lag(log(wage), 0:1)1     0.479968   0.063831  7.5193 5.506e-14 ***
lag(log(capital), 0:1)0  0.478242   0.045499 10.5110 < 2.2e-16 ***
lag(log(capital), 0:1)1 -0.419226   0.047809 -8.7687 < 2.2e-16 ***

###########
z8 <- pgmm(log(emp) ~ lag(log(emp), 1)+ lag(log(wage), 0:1) +
lag(log(capital), 0:1) | lag(log(emp), 2:8) +
lag(log(wage), 2:8) + lag(log(capital), 2:8),
data = EmplUK, effect = "twoways", model = "onestep",
transformation = "ld")
summary(z8)
Coefficients
                         Estimate Std. Error z-value  Pr(>|z|)   
lag(log(emp), 1)         0.935605   0.016302 57.3931 < 2.2e-16 ***
lag(log(wage), 0:1)0    -0.630976   0.069328 -9.1013 < 2.2e-16 ***
lag(log(wage), 0:1)1     0.482620   0.063722  7.5739 3.623e-14 ***
lag(log(capital), 0:1)0  0.483930   0.044933 10.7701 < 2.2e-16 ***
lag(log(capital), 0:1)1 -0.424393   0.047422 -8.9492 < 2.2e-16 ***

###########
z99 <- pgmm(log(emp) ~ lag(log(emp), 1)+ lag(log(wage), 0:1) +
lag(log(capital), 0:1) | lag(log(emp), 2:99) +
lag(log(wage), 2:99) + lag(log(capital), 2:99),
data = EmplUK, effect = "twoways", model = "onestep",
transformation = "ld")
summary(z99)
Coefficients
                         Estimate Std. Error z-value  Pr(>|z|)   
lag(log(emp), 1)         0.935605   0.016302 57.3931 < 2.2e-16 ***
lag(log(wage), 0:1)0    -0.630976   0.069328 -9.1013 < 2.2e-16 ***
lag(log(wage), 0:1)1     0.482620   0.063722  7.5739 3.623e-14 ***
lag(log(capital), 0:1)0  0.483930   0.044933 10.7701 < 2.2e-16 ***
lag(log(capital), 0:1)1 -0.424393   0.047422 -8.9492 < 2.2e-16 ***

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2011-11-12 10:09:18
感谢epoh!!!

那么请问在分析别的数据时,如何确定这个数呢?是根据自己的经验,还是有什么规则呢?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群