plm问题,重复的时间ID错误 [英] Problems with plm, duplicate time id's error

查看:121
本文介绍了plm问题,重复的时间ID错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在执行固定效果回归并收到以下错误:

I am running a fixed effects regression and am getting the following error:

fixed_effects <- plm(GNI ~ lag(GNI) + imposition + ExpImp + democ, 
data = sanctions_data6, index = c("country", "sanctions_period"), model =
"within", effect = "twoways")

duplicate couples (time-id)
Error in pdim.default(index[[1]], index[[2]]) : 

我知道这意味着我有相同的重复时间段观察.但是,由于观察到的结果代表了不同类型的制裁,因此它们并不是彼此重复的.

I am aware that it means that i have duplicate time periods for the same observations. However the whole observations are not duplicates of each other as they represent different types of sanctions imposed.

           country        sanctions_period     sanction_type
             (chr)            (chr)            (int)
1          Afghanistan        1995-2002          4
2          Afghanistan        1995-2002          7
3          Afghanistan        1995-2002          NA

我如何解决这个问题并进行回归分析以查看结果?谢谢!

How can i get around this problem and run a regression in order to see the results? Thanks!

推荐答案

在两个不同的帖子中对此进行了讨论:

This as been discussed in two different posts:

Fixed Effects plm软件包R-每年/id多次观察

基本上, plm 希望您为每个组具有唯一的时间值.您可以通过创建Sanctions_period -sanction_type变量来简单地创建唯一的时间值,从而欺骗 plm .

Basically, plm want you to have unique time values for each group. You can trick plm by simply creating unique time values by creating a sanctions_period -sanction_type variable.

这篇关于plm问题,重复的时间ID错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆