R:条款错误。默认(公式):没有术语组件也没有属性(pgmm函数)

时间:2018-05-17 08:37:39

标签: r

我尝试学习如何将GMM方法与R(Arellano-Bond估计器)一起使用。所以我使用包plm中的PGMM命令。

我复制了这个例子的代码:https://www.rdocumentation.org/packages/plm/versions/1.6-5/topics/pgmm

使用这些数据:

Date        country       credit    a   b   c   d   e   f   g    h  i   j   

2000-01-01  Germany     3840,304    0   0   0   0   0   0   1   .b  0   -1
2000-04-01  Germany     3891,104    0   0   0   0   0   0   0   .b  0   0
2000-07-01  Germany     3916,966    0   0   0   0   0   0   0   .b  0   0
2000-10-01  Germany     3984,611    0   0   0   0   0   0   0   .b  0   0
2001-01-01  Germany     4003,066    0   0   0   0   0   0   0   .b  0   0
2001-04-01  Germany     4012,048    0   0   0   0   0   0   0   .b  0   0
2001-07-01  Germany     4053,672    0   0   0   0   0   0   0   .b  0   0
2001-10-01  Germany     4097,941    0   0   0   0   0   0   0   .b  0   0
2002-01-01  Germany     4108,002    0   0   0   0   0   0   0   .b  0   0
2002-04-01  Germany     4142,119    0   0   0   0   0   0   0   .b  0   0
2002-07-01  Germany     4210,727    0   0   0   0   0   0   0   .b  0   0
2002-10-01  Germany     4220,897    0   0   0   0   0   0   0   .b  0   0
2003-01-01  Germany     4280,548    0   0   0   0   0   0   0   .b  0   0
2003-04-01  Germany     4331,072    0   0   0   0   0   0   0   .b  0   0
2003-07-01  Germany     4322,555    0   0   0   0   0   0   0   .b  0   0
2003-10-01  Germany     4338,01     0   0   0   0   0   0   0   .b  0   0
2004-01-01  Germany     4370,032    0   0   0   0   0   0   0   .b  0   0
2004-04-01  Germany     4354,935    0   0   0   0   0   0   0   .b  0   0
2004-07-01  Germany     4375,466    0   0   0   0   0   0   0   .b  0   0
2004-10-01  Germany     4390,958    0   0   0   0   0   0   0   .b  0   0
2005-01-01  Germany     4396,222    0   0   0   0   0   0   0   .b  0   0
2005-04-01  Germany     4448,471    0   0   0   0   0   0   0   .b  0   0
2005-07-01  Germany     4471,893    0   0   0   0   0   0   0   .b  0   0
2005-10-01  Germany     4451,653    0   0   0   0   0   0   0   .b  0   0
2006-01-01  Germany     4477,181    0   0   0   0   0   0   0   .b  0   0
2006-04-01  Germany     4497,384    0   0   0   0   0   0   0   .b  0   0
2006-07-01  Germany     4545,383    0   0   0   0   0   0   0   .b  0   0
2006-10-01  Germany     4527,901    0   0   0   0   0   0   0   .b  0   0
2007-01-01  Germany     4523,691    0   0   0   0   0   0   1   .b  0   0
2007-04-01  Germany     4514,656    0   0   0   0   0   0   0   .b  0   0
2007-07-01  Germany     4510,95     0   0   0   0   0   0   0   .b  0   0
2007-10-01  Germany     4552,084    0   0   0   0   0   0   0   .b  0   0
2008-01-01  Germany     4577,551    0   0   0   0   0   0   0   .b  0   0
2008-04-01  Germany     4590,665    0   0   0   0   0   0   0   .b  0   0
2008-07-01  Germany     4619,162    0   0   0   0   0   0   0   .b  0   0
2008-10-01  Germany     4719,901    0   0   0   0   0   0   0   .b  0   0
2009-01-01  Germany     4747,204    0   0   0   0   0   0   0   .b  0   0
2009-04-01  Germany     4788,791    0   0   0   0   0   0   0   .b  0   0
2009-07-01  Germany     4794,392    0   0   0   0   0   0   0   .b  0   0
2009-10-01  Germany     4803,617    0   0   0   0   0   0   0   .b  0   0
2010-01-01  Germany     4832,948    0   0   0   0   0   0   0   .b  0   0
2010-04-01  Germany     4925,639    0   0   0   0   0   0   0   .b  0   0
2010-07-01  Germany     4971,252    0   0   0   0   0   0   0   .b  0   0
2010-10-01  Germany     5122,327    0   0   0   0   0   0   0   .b  0   0
2011-01-01  Germany     5041,913    0   0   0   0   0   0   1   .b  0   0
2011-04-01  Germany     5079,78     0   0   0   0   0   0   0   .b  0   0
2011-07-01  Germany     5207,961    0   0   0   0   0   0   0   .b  0   0
2011-10-01  Germany     5231,821    0   0   0   0   0   0   0   .b  0   0
2012-01-01  Germany     5280,251    0   0   0   0   1   0   0   .b  0   -1
2012-04-01  Germany     5392,063    0   0   0   0   0   0   0   .b  0   0
2012-07-01  Germany     5400,905    0   0   0   0   0   0   0   .b  0   0
2012-10-01  Germany     5412,811    0   0   0   0   0   0   0   .b  0   0
2013-01-01  Germany     5422,592    0   0   0   0   0   0   0   .b  0   0
2013-04-01  Germany     5430,467    0   0   0   0   0   0   0   .b  0   0
2013-07-01  Germany     5398,361    0   0   0   0   0   0   0   .b  0   0
2013-10-01  Germany     5432,462    0   0   0   0   0   0   0   .b  0   0
2014-01-01  Germany     5456,415    0   0   0   0   1   0   1   .b  0   0
2014-04-01  Germany     5504,142    0   0   0   0   0   0   0   .b  0   0
2014-07-01  Germany     5516,876    0   0   0   0   0   0   0   .b  0   0
2014-10-01  Germany     5532,75     0   0   0   0   0   0   0   .b  0   0

因变量是“信用”,而a,b,c ....是独立变量。后者是宏观审慎和货币政策。所以我试着看看这些政策(加上滞后因变量)对信贷增长的影响。

对于这些策略,索引在收紧时取值为1,没有变化时为0,如果松开则取值为-1。

我试了几次,我总是犯同样的错误:条款错误。默认(公式):没有条款组件也没有属性

一些尝试:

test <- pgmm(credit) ~ lag(credit)+lag(a)+lag(b), data = BDD)


pgmm(credit ~ lag((credit), 1) + lag((sscb_res), 1), data = BDD, effect = "twoways", model = "twosteps")
pgmm(credit ~ lag((credit), 0:1) + lag((sscb_res), 0:1), data = BDD, effect = "twoways", model = "twosteps")

等等。我不知道该怎么办。你认为它来自数据中的大数“0”吗?

我按照这个例子:

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")

但是,我不明白为什么一个滞后有“0:1”而不是“1”。

你能帮我吗?

PS:请原谅我的英文

0 个答案:

没有答案