全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
91752 27
2012-12-23

求问,xtset和tsset的区别

二维码

扫码加我 拉你入群

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

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

全部回复
2012-12-23 11:37:30
There are two syntaxes for setting the data:

                tsset timevar

                tsset panelvar timevar

    In the first syntax -- tsset timevar -- the data are set to be a straight time series.

    In the second syntax -- tsset panelvar timevar -- the data are set to be a collection of time series, one for
    each value of panelvar, also known as panel data, cross-sectional time-series data, and xt data.  Such datasets
    can be analyzed by xt commands as well as ts commands.  If you tsset panelvar timevar, you do not need to xtset
    panelvar timevar to use the xt commands.

二维码

扫码加我 拉你入群

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

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

2012-12-23 11:45:51
如果是要处理panel data,两者等价;
如果处理费panel data,参见详细命令
二维码

扫码加我 拉你入群

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

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

2012-12-23 16:51:44
fgleric 发表于 2012-12-23 11:45
如果是要处理panel data,两者等价;
如果处理费panel data,参见详细命令
处理非面板数据的话,能不能介绍一下区别,我看不太懂
二维码

扫码加我 拉你入群

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

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

2012-12-23 21:39:08
jtengyp 发表于 2012-12-23 16:51
处理非面板数据的话,能不能介绍一下区别,我看不太懂
处理非面板数据
xtset is used to declare the dataset is panel data, see example

webuse pig
xtset id week

declare data is panel with id as identifier and stub is week
.        xtset id week
        panel variable:        id (strongly        balanced)
        time variable:        week, 1 to 9
        delta:        1 unit

tsset is used to declare the data is time-series data, see example
use the same dataset as above:

. tsset week
repeated time        values        in        sample
r(451);

the reason of error is because week is not a time-series variable. list  week in 1/10

     | week |
     |------|
  1. |    1 |
  2. |    1 |
  3. |    1 |
  4. |    1 |
  5. |    1 |
     |------|
  6. |    1 |
  7. |    1 |
  8. |    1 |
  9. |    1 |
10. |    1 |


now show a case where tsset can be applied to time-series data
webuse dow1
tsset date



.             . tsset date
        time variable:  date, 02jan1953 to 20feb1990, but with gaps
                delta:  1 day

list date in 1/10

      |      date |
      |-----------|
   1. | 02jan1953 |
   2. | 05jan1953 |
   3. | 06jan1953 |
   4. | 07jan1953 |
   5. | 08jan1953 |
      |-----------|
   6. | 09jan1953 |
   7. | 12jan1953 |
   8. | 13jan1953 |
   9. | 14jan1953 |
  10. | 15jan1953 |





二维码

扫码加我 拉你入群

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

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

2012-12-28 13:31:13
learning.
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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