全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
5718 3
2013-05-27
在《A Handbook of Statistical Analyses using Stata, 4th edition》一书的第6.3.1节(第116页)中,作者利用egen命令分别创建了两个新变量

...
egen therapy = seq() , from(0) to(1) block(2)
egen sex = seq() , from(1) to(2)  by(therapy)

label define t 0 seq 1alt
label values therapy t
label define s 1 male 2 female
label values sex s


查看 help egen 中有关 seq() 的介绍,我明白了这个命令所生成的新变量时一个取值从from(#) to(#) 的整数序列,不过对于block(#)选项,我就没弄懂。帮助中的意思是block()选项是用于设定observations的分块的,但是仅仅设定分成几块,而没有说明如何分块,对于这个命令所生成的新变量的取值会产生什么影响呢?


故此,向各位坛友请教!


-------------------------------------------------------
补充:help egen 中 关于 seq() 的说明文字
        seq() [, from(#) to(#) block(#)]                                  (allows by varlist:)  
            returns integer sequences.  Values start from from() (default 1) and increase to
            to() (the default is the maximum number of values) in blocks (default size 1)
.  If
            to() is less than the maximum number, sequences restart at from().  Numbering may
            also be separate within groups defined by varlist or decreasing if to() is less
            than from().  Sequences depend on the sort order of observations, following three
            rules: 1) observations excluded by if or in are not counted; 2) observations are
            sorted by varlist, if specified; and 3) otherwise, the order is that when called.
            No arguments are specified.




二维码

扫码加我 拉你入群

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

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

全部回复
2013-5-27 20:46:34
区组的意思!
二维码

扫码加我 拉你入群

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

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

2013-5-27 21:54:23
看stata的manual的egen中的例子你就明白了
二维码

扫码加我 拉你入群

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

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

2013-5-28 09:26:00
蓝色 发表于 2013-5-27 21:54
看stata的manual的egen中的例子你就明白了
好的,多谢蓝色版主。看到【d】第175页中的例子,变量b的生成结果,总算弄明白了,敢情block(#)这个选项的意思是序列中的数字重复生成,重复的次数就是#,具有相同序列数字值的obs是一个block。
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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