R: plm -- year fixed effects -- year and quarter data

I am having a problem setting up a panel data model. Here is some sample data: library(plm) id <- c(1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2) year <- c(1999,1999,1999,1999,2000,2000,2000,2000,1999,1999,1999,1999,2000,2000,2000,2000) qtr <- c(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4) y <- rnorm(16, mean=0, sd=1) x <- rnorm(16, mean=0, sd=1) data <- data.frame(id=id,year=year,qtr=qtr,y_q=paste(year,qtr,sep="_"),y=y,x=x) I run the following regression using 'id' as the individual index and 'year' as the time index: reg1 <- plm(y ~ x, data=data,index=c("id", "year"), model="within",effect="time") Unfortunately, I get the following error: > duplicate couples (time-id) Error in pdim.default(index[[1]], index[[2]]) : So to get around that, I use the combined variable that is 'y_q': reg1 <- plm(y ~ x, data=data,index=c("id", "y_q"), model="within",effect="time") But here's my issue -- I only want to have year fixed effects and not year-quarter. Is there another way to get around the earlier issue instead of making the tiem index 'y_q'? Thanks ahead of time for any help!
see also stackoverflow.com/questions/28789767/…

以上就是R: plm -- year fixed effects -- year and quarter data的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏