全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
47400 16
2007-10-13

我做面板数据的2sls时,需要用xtset设定面板的id和year。

当我输入命令xtivreg y (x1 x2=iv1 iv2),fe后,显示“must specify panelvar; use xtset”

而后我输入命令“xtset company year” 却又显示“repeated time values within panel”

但我再输入xtivreg y (x1 x2=iv1 iv2),fe,仍然显示“must specify panelvar; use xtset”

而后,我输入命令“xtset ,clear",再输入“xtset company year” 它仍然告诉我“repeated time values within panel”

以致我做不了回归,请问这是为什么???

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2007-10-13 08:41:00

能明白 这句话的意思吗? repeated time values within pane

翻译出来就知道那里错了。

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2007-10-13 09:43:00
使用一下论坛的搜索功能,赫赫
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2007-10-13 10:55:00

刚学stata的面板操作时好象很多人都会遇到这个问题,而且不知道怎么解决?记得当初我也是这样的。

以下是引用蓝色在2007-10-8 16:45:00的发言:

是你的数据的问题

id和obs

就是同一个id可能有两个或者两个以上的相同的obs

如:

id     obs

1      1990

1      1990

1      1991

所以你的检查你的id和obs

[此贴子已经被作者于2007-10-13 11:00:45编辑过]

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2007-10-14 08:34:00

* input the data

clear

input id year
1      1990
1      1990
1      1991
2      1990
2      1991
2      1991
end

* xtset , but stata report error!

xtset id year

repeated time values within panel
r(451);

* because, there are repeated year obs

duplicates report

Duplicates in terms of id year

--------------------------------------
   copies | observations       surplus
----------+---------------------------
        1 |            2             0
        2 |            4             2
--------------------------------------

* solution: drop duplicates

duplicates drop id year, force

Duplicates in terms of id year

(2 observations deleted)

* Now,xtset is OK

xtset id year
       panel variable:  id (strongly balanced)
        time variable:  year, 1990 to 1991

*-----Appdex--------The do files----------------

clear
input id year
1      1990
1      1990
1      1991
2      1990
2      1991
2      1991
end

cap xtset id year
duplicates report id year
duplicates drop id year, force
xtset id year

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-4-5 18:59:00
arlion真是救火车啊
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群