对于所有美国州,我正在使用州*年协变量进行回归。我需要访问N.J.的那些,这可能只是我的输出停止的几个状态。如何在保持输出结构的同时访问对象的中间,以便我可以识别相应的状态系数?这是我到目前为止的代码:
g <- as.Formula(fatalityrate~sb_useage+speed65+speed70+ba08+drinkage21+log(income)+age)
g <- update(g, . ~ . + year)
g <- update(g, . - fatalityrate + sb_useage ~ . - sb_useage + primary + secondary + factor(state)*year)
sb <- plm(g, data = pnl_sb, model = "within", effect = "twoways", index = c("fips","year"))
sb_c <- coeftest(sb, vcovHC)
z test of coefficients:
Estimate Std. Error z value Pr(>|z|)
speed65 -4.3506e-02 1.4132e-15 -3.0785e+13 < 2.2e-16 ***
speed70 2.7920e-02 1.7666e-15 1.5805e+13 < 2.2e-16 ***
ba08 1.3878e-01 7.9562e-15 1.7443e+13 < 2.2e-16 ***
drinkage21 -5.2707e-01 1.4493e-14 -3.6368e+13 < 2.2e-16 ***
log(income) 1.0611e-01 3.5164e-14 3.0175e+12 < 2.2e-16 ***
age 1.7745e-01 1.5497e-14 1.1450e+13 < 2.2e-16 ***
primary 4.2674e-02 9.3908e-15 4.5443e+12 < 2.2e-16 ***
secondary -1.9863e-01 6.4951e-15 -3.0581e+13 < 2.2e-16 ***
year1984:factor(state)AL 3.2376e-01 1.0903e-14 2.9695e+13 < 2.2e-16 ***
year1985:factor(state)AL 6.5355e-01 9.5593e-15 6.8368e+13 < 2.2e-16 ***
year1986:factor(state)AL 4.7362e-01 7.2047e-15 6.5737e+13 < 2.2e-16 ***
year1987:factor(state)AL 2.8150e-01 3.1782e-15 8.8574e+13 < 2.2e-16 ***
year1988:factor(state)AL -1.4605e-01 1.1052e-14 -1.3214e+13 < 2.2e-16 ***
.
.
.
我想使用head或tail选项,但是我无法找到使用这些命令访问数据帧中间的文档。此外,我需要能够识别与系数相关的状态,而head / tail命令仅返回系数。