使用plm软件包管理时间效果

时间:2018-09-04 13:45:02

标签: r panel-data plm

我有一个与此相似的数据框

Q1 <- data.frame(id=c("A","B","C","D","E"), assets = c(22,560,7,7841,785), qtr = c(1,1,1,1,1))
Q2 <- data.frame(id=c("A","B","C","D","E"), assets = c(48,767,88,7410,698), qtr = c(2,2,2,2,2))
Q3 <- data.frame(id=c("A","B","C","D","E"), assets = c(130,530,57,5000,741), qtr = c(3,3,3,3,3))
Q4 <- data.frame(id=c("A","B","C","D","E"), assets = c(77,821,101,5500,789), qtr = c(4,4,4,4,4))
df <- rbind(Q1,Q2,Q3,Q4)     
df$event <- ifelse(df$qtr >= 3,1,0)
df$affected <- ifelse(df$id %in% c("A","C"),1,0)

然后我像这样进行回归

plm(assets ~ event + event*affected, data = df, index = c("id","qtr"), model = "within", effect = "twoways")

现在,我想控制个人和时间效应,但是控制时间效应摆脱了事件系数。计算时间效应时是否可以更改?我的意思是说,控制年度时间影响将对我有用,并且在这种情况下,事件系数应该保持不变。因此,有一种方法可以在不更改索引的情况下更改时间影响计算的时间范围,因为我仍然会有季度数据。

0 个答案:

没有答案