楼主: sishisiren
16800 5

[回归分析求助] 多项logit模型,如果自变量是分类变量,如何处理呢? [推广有奖]

  • 2关注
  • 1粉丝

已卖:127份资源

副教授

18%

还不是VIP/贵宾

-

威望
0
论坛币
648 个
通用积分
8.7604
学术水平
6 点
热心指数
9 点
信用等级
6 点
经验
1865 点
帖子
283
精华
0
在线时间
1195 小时
注册时间
2009-11-8
最后登录
2025-9-10

楼主
sishisiren 发表于 2012-12-26 11:17:52 |AI写论文
10论坛币
多项logit模型好像默认的自变量都是连续变量吧,那么,如果自变量中有分类变量,用stata如何针对此变量设置参照组呢?求解,谢谢。

最佳答案

dachuan520 查看完整内容

用tab var,gen(var)试试生成虚拟变量
关键词:多项Logit模型 logit模型 多项Logit logit 分类变量 自变量 模型 如何
这世界笑了,于是你合群地一起笑了。。。

沙发
dachuan520 发表于 2012-12-26 11:17:53
用tab var,gen(var)试试生成虚拟变量

藤椅
statalearning 发表于 2012-12-27 00:22:35
还是看楼下的指导。

板凳
蓝色 发表于 2012-12-27 01:19:07
看帮助Factor variables的解释
Title

    [U] 11.4.3 Factor variables


Base levels

    You can specify the base level of a factor variable by using the ib. operator.  The syntax is

           Base         
           operator(*)    Description
           ---------------------------------------------------------------------------------------------------------
           ib#.           use # as base, #=value of variable
           ib(##).        use the #th ordered value as base (**)
           ib(first).     use smallest value as base (the default)
           ib(last).      use largest value as base
           ib(freq).      use most frequent value as base
           ibn.           no base level
           ---------------------------------------------------------------------------------------------------------
            (*) The i may be omitted.  For instance, you may type ib2.group or b2.group.
           (**) For example, ib(#2). means to use the second value as the base.

    If you want to use group==3 as the base in a regression, you can type,

        . regress y  i.sex ib3.group


    You can also permanently set the base levels of categorical variables by using the fvset command.


Selecting levels

    You can select a range of levels -- a range of virtual variables -- by using the i(numlist). operator.

         Examples          Description
         -----------------------------------------------------------------------------------------------------------
         i2.cat            a single indicator for cat==2

         2.cat             same as i2.cat

         i(2 3 4).cat      three indicators, cat==2, cat==3, and cat==4;
                             same as i2.cat i3.cat i4.cat

         i(2/4).cat        same as i(2 3 4).cat

         2.cat#1.sex       a single indicator that is 1 when cat==2 and sex==1, and is 0 otherwise

         i2.cat#i1.sex     same as 2.cat#1.sex
         -----------------------------------------------------------------------------------------------------------



报纸
monstersivle 发表于 2012-12-28 10:39:58
xi: 是专门生成分类变量dummy的命令,还用来生成分类变量和其它变量的交叉项,分类变量放在前面,比如 i.rep78*gear_ratio,
xi: regress mpg i.rep78
生成的变量有 (每个都是判断变量,比如_Irep78_2 , 如果rep78==2,则回馈1,否则0)
_Irep78_2      
_Irep78_3      
_Irep78_4      
_Irep78_5  
rep78==1的自动作为参照组,省去(omitted),为避免多重共线性,即变量间可以用线性关系表示。
这样,所有回归出的分类变量上的系数都是相对于参照组rep78==1而言的。

不爱其亲而爱他人者,谓之悖德;不敬其亲而敬他人者,谓之悖礼。——《孝经》

地板
peyzf 发表于 2013-1-1 07:17:04
learning.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-1 17:03