楼主: 2016551168
16574 5

[回归分析求助] stata做回归的时候,控制变量前面加c.是什么意思啊?比如c.edu [推广有奖]

  • 0关注
  • 0粉丝

初中生

95%

还不是VIP/贵宾

-

威望
0
论坛币
6 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
448 点
帖子
10
精华
0
在线时间
22 小时
注册时间
2021-6-13
最后登录
2022-10-15

楼主
2016551168 发表于 2021-8-11 10:54:53 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
stata做回归的时候,控制变量前面加c.是什么意思啊?比如c.edu
二维码

扫码加我 拉你入群

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

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

关键词:Stata 是什么意思 控制变量 tata edu

沙发
wdlbcj 学生认证  发表于 2021-8-11 11:59:45
加c.或者是i. 一般都是为了构造交互项使用的

藤椅
917968079 发表于 2021-8-11 17:39:43 来自手机
2016551168 发表于 2021-8-11 10:54
stata做回归的时候,控制变量前面加c.是什么意思啊?比如c.edu
c.连续变量,i.虚拟变量

板凳
蓝色 发表于 2021-8-11 17:52:36
详细的可以查看帮助里面的例子
help fvvarlist



Title

    [U] 11.4.3 Factor variables
Description

    Factor variables are extensions of varlists of existing variables.  When
    a command allows factor variables, in addition to typing variable names
    from your data, you can type factor variables, which might look like

        i.varname

        i.varname#i.varname

        i.varname#i.varname#i.varname

        i.varname##i.varname

        i.varname##i.varname##i.varname

    Factor variables create indicator variables from categorical variables,
    interactions of indicators of categorical variables, interactions of
    categorical and continuous variables, and interactions of continuous
    variables (polynomials).  They are allowed with most estimation and
    postestimation commands, along with a few other commands.

    There are five factor-variable operators:

         Operator  Description
         -------------------------------------------------------------------
         i.        unary operator to specify indicators
         c.        unary operator to treat as continuous
         o.        unary operator to omit a variable or indicator
         #         binary operator to specify interactions
         ##        binary operator to specify factorial interactions

         -------------------------------------------------------------------

    The indicators and interactions created by factor-variable operators are
    referred to as virtual variables.  They act like variables in varlists
    but do not exist in the dataset.

    Categorical variables to which factor-variable operators are applied
    must contain nonnegative integers with values in the range 0 to 32,740,
    inclusive.

    Factor variables may be combined with the L. and F. time-series
    operators.


Remarks

    Remarks are presented under the following headings:

        Basic examples
        Base levels
        Selecting levels
        Applying operators to a group of variables
        Video examples


Basic examples

    Here are some examples of use of the operators:

         Factor            
         specification     Result
         -------------------------------------------------------------------
         i.group           indicators for levels of group

         i.group#i.sex     indicators for each combination of levels of
                             group and sex, a two-way interaction

         group#sex         same as i.group#i.sex

         group#sex#arm     indicators for each combination of levels of
                             group, sex, and arm, a three-way interaction

         group##sex        same as i.group i.sex group#sex

         group##sex##arm   same as i.group i.sex i.arm group#sex group#arm
                             sex#arm group#sex#arm

         sex#c.age         two variables -- age for males and 0 elsewhere,
                             and age for females and 0 elsewhere; if age is
                             also in the model, one of the two virtual
                             variables will be treated as a base

         sex##c.age        same as i.sex age sex#c.age

         c.age             same as age

         c.age#c.age       age squared

         c.age#c.age#c.age age cubed
         -------------------------------------------------------------------


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.

    Thus, 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.
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
Sunknownay + 3 + 3 + 3 热心帮助其他会员

总评分: 学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

报纸
2016551168 发表于 2021-8-14 09:33:05
917968079 发表于 2021-8-11 17:39
c.连续变量,i.虚拟变量
非常感谢666

地板
2016551168 发表于 2021-8-14 09:33:25
蓝色 发表于 2021-8-11 17:52
详细的可以查看帮助里面的例子
help fvvarlist
感谢,学到了

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

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