楼主: livingboy
10697 6

请教高手,关于stata8的逐步回归命令 [推广有奖]

  • 0关注
  • 0粉丝

学前班

70%

还不是VIP/贵宾

-

威望
0
论坛币
2 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
29 点
帖子
4
精华
0
在线时间
0 小时
注册时间
2009-9-27
最后登录
2010-3-29

楼主
livingboy 发表于 2010-3-29 11:42:42 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
在stata8里我写的是这个sw reg y x1 x2,fe(1.5) fs(1.5),但每次都出现如下错误:
fe(1.5) fs(1.5) not allowed,
r(198);
恳忘高人指点啊,万分感谢!!!
二维码

扫码加我 拉你入群

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

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

关键词:Stata 请教高手 tata 逐步回归 allowed 请教 高手 命令 逐步回归

沙发
livingboy 发表于 2010-3-29 13:03:50
继续期待……

藤椅
蓝色 发表于 2010-3-29 13:29:45
--------------------------------------------------------------------------------------------------------------------
help for sw                                                                                          manual:  [R] sw
                                                                                                     dialog:  sw   
--------------------------------------------------------------------------------------------------------------------

Stepwise estimation

        sw cmd term [term ...] [weight] [if exp] [in range], { pr(#) | pe(#) | pr(#) pe(#) } [ forward lr hier
                    lockterm1 cmd_options ]

    where term is either a varname or (varlist) (a varlist in parentheses, indicating that this group of variables
    are to be included or excluded together) and cmd is one of


没有你的那个选项啊

板凳
livingboy 发表于 2010-3-29 14:02:50
首先,还是先谢谢你。我是在一个教程上看到的,逐步回归命令如下:
stepwise  因变量   变 量1 变 量2 变 量m,ba  forw  st fe(#)  fs(#)
例如:stepwise  y x1 x2 x3, fe(1.5) fs(1.5);
自己也不是学经济金融的,所以跟前也没人懂,在网上查了一下,说stata8的逐步回归命令前面应该是sw cmd……这种格式,但还是搞不清具体命令是啥

报纸
livingboy 发表于 2010-3-29 14:15:09
刚开始学,看的教程好像和现有的软件不配套,还想问问斑竹:
{ pr(#) | pe(#) | pr(#) pe(#) } [ forward lr hier lockterm1 cmd_options ]
后面的命令都怎么解释啊??(我就知道forward是啥意思,哎)谢谢!

地板
蓝色 发表于 2010-3-29 16:00:34
--------------------------------------------------------------------------------------------------------------------
help for sw                                                                                          manual:  [R] sw
                                                                                                     dialog:  sw   
--------------------------------------------------------------------------------------------------------------------

Stepwise estimation

        sw cmd term [term ...] [weight] [if exp] [in range], { pr(#) | pe(#) | pr(#) pe(#) } [ forward lr hier
                    lockterm1 cmd_options ]

    where term is either a varname or (varlist) (a varlist in parentheses, indicating that this group of variables
    are to be included or excluded together) and cmd is one of

        clogit | cloglog | cnreg | glm | logistic | logit | nbreg | ologit | oprobit | poisson | probit | qreg |
        regress | stcox | streg | tobit

    For example

        . sw regress mpg weight displ, pr(.2)

    would perform backward-selection linear regression.

    by ... : may be used with sw; see help by.

    Weights are allowed if cmd allows them.

    sw shares the features of all estimation commands; see help estcom.

    predict after sw behaves the same as predict after the particular estimation command; see help for the
    particular estimation command for details.


Description

    sw performs stepwise estimation, the flavor of which is determined by the options specified:

        pr(#)                 backward selection
        pr(#) hier            backward hierarchical selection
        pr(#) pe(#)           backward stepwise

        pe(#)                 forward selection
        pe(#) hier            forward hierarchical selection
        pr(#) pe(#) forward   forward stepwise


Options

    pr(#) specifies the significance level for removal from the model; terms with p>=pr() are eligible for
        removal.

    pe(#) specifies the significance level for addition to the model; terms with p<pe() are eligible for addition.

    forward specifies the forward-stepwise method when both pr() and pe() are also specified.  Specifying both
        pr() and pe() without forward results in backward stepwise.  Note that specifying only pr() results in
        backward selection and specifying only pe() results in forward selection.

    lr specifies the test of term significance is to be the likelihood-ratio test.  The default is the less
        computationally expensive Wald test.

    hier specifies hierarchical selection.

    lockterm1 specifies that the first term is to be included in the model and not subjected to the selection
        criteria.

    cmd_options refers to any of the options of the estimation command.  sw operates by iterating the estimation
        command to obtain results.


Examples

    . sw reg price mpg weight displ, pr(.2)
    . sw reg price mpg weight displ (r1-r4), pr(.2)
    . sw reg price mpg weight displ (r1-r4), pr(.2) hier
    . sw reg price mpg (weight displ) (r1-r4), pr(.2) hier

    . sw logit outcome (sex weight) treated1 treated2, pr(.2)
    . sw logit outcome (sex weight) treated1 treated2, pr(.2) lockterm1

    . sw


Also see

    Manual:  [U] 23 Estimation and post-estimation commands,
             [U] 29 Overview of Stata estimation commands,
             [R] sw

    Online:  help for estcom, postest;
             help for the commands listed below the syntax diagram.

7
steven_64 发表于 2011-8-23 23:58:53
Title

    [R] stepwise -- Stepwise estimation


Syntax

        stepwise [, options ] : command

    options           description
    -------------------------------------------------------------------------
    Model
    * pr(#)           significance level for removal from the model
    * pe(#)           significance level for addition to the model

    Model2
      forward         perform forward-stepwise selection
      hierarchical    perform hierarchical selection
      lockterm1       keep the first term
      lr              perform likelihood ratio-test instead of Wald test
    -------------------------------------------------------------------------
    * At least one of pr(#) or pe(#) must be specified.
    by and xi are allowed; see prefix.
    Weights are allowed if command allows them; see weight.
    All postestimation commands behave as they would after command without
      the stepwise prefix; see the postestimation manual entry for command.


Menu

    Statistics > Other > Stepwise estimation


Description

    stepwise performs stepwise estimation.  Typing

        . stepwise, pr(#): command

    performs backward-selection estimation for command.  The stepwise
    selection method is determined by the following option combinations:

    options                   description
    -------------------------------------------------------------------------
    pr(#)                     backward selection
    pr(#) hierarchical        backward hierarchical selection
    pr(#) pe(#)               backward stepwise

    pe(#)                     forward selection
    pe(#) hierarchical        forward hierarchical selection
    pr(#) pe(#) forward       forward stepwise
    -------------------------------------------------------------------------

    command defines the estimation command to be executed.  The following
    Stata commands are supported by stepwise.

        clogit, cloglog, glm, intreg, logistic, logit, nbreg, ologit,
        oprobit, poisson, probit, qreg, regress, scobit, stcox, stcrreg,
        streg, tobit

    stepwise expects command to have the following form:

        command_name [depvar] term [term ...] [if] [in] [weight] [,
                     command_options]

    where term is either varname or (varlist) (a varlist in parentheses
    indicates that this group of variables is to be included or excluded
    together).  depvar is not present when command_name is streg, stcox, or
    stcrreg; otherwise, depvar is assumed to be present.  For intreg, depvar
    is actually two dependent variable names (depvar1 and depvar2).

    sw is a synonym for stepwise.


Options

        +-------+
    ----+ Model +------------------------------------------------------------

    pr(#) specifies the significance level for removal from the model; terms
        with p>=pr() are eligible for removal.

    pe(#) specifies the significance level for addition to the model; terms
        with p<pe() are eligible for addition.

        +--------+
    ----+ Model2 +-----------------------------------------------------------

    forward specifies the forward-stepwise method and may be specified only
        when both pr() and pe() are also specified.  Specifying both pr() and
        pe() without forward results in backward-stepwise selection.
        Specifying only pr() results in backward selection, and specifying
        only pe() results in forward selection.

    hierarchical specifies hierarchical selection.

    lockterm1 specifies that the first term be included in the model and not
        be subjected to the selection criteria.

    lr specifies the test of term significance be the likelihood-ratio test.
        The default is the less computationally expensive Wald test; that is,
        the test is based on the estimated variance-covariance matrix of the
        estimators.


Examples

    Setup
        . sysuse auto
        . generate weight2 = weight^2

    Backward selection
        . stepwise, pr(.2): regress mpg weight weight2 displ gear turn
            headroom foreign price

    Backward selection; consider engine displacement and gear ratio together
        . stepwise, pr(.2): regress mpg weight weight2 (displ gear) turn
            headroom foreign price

    Backward selection; force weight to be included in model
        . stepwise, pr(.2) lockterm1: regress mpg weight weight2 displ gear
            turn headroom foreign price

    Backward selection; force weight and weight2 to be included in model
        . stepwise, pr(.2) lockterm1: regress mpg (weight weight2) displ gear
            turn headroom foreign price

    Backward hierarchical selection
        . stepwise, pr(.2) hierarchical: regress mpg weight weight2 displ
            gear turn headroom foreign

    Forward selection
        . stepwise, pe(.2): regress mpg weight weight2 displ gear turn
            headroom foreign price

    Forward hierarchical selection
        . stepwise, pe(.2) hierarchical: regress mpg weight weight2 displ
            gear turn headroom foreign price


Programming for stepwise

    stepwise requires that command_name follow standard Stata syntax and
    allow the if qualifier.  Furthermore, command_name must have sw or swml
    as a program property; see [P] program properties.  If command_name has
    swml as a property, command_name must save the log-likelihood value in
    e(ll) and model degrees of freedom in e(df_m).


Saved results

    stepwise saves whatever is saved by the underlying estimation command.

    Also, stepwise saves stepwise in e(stepwise).


Also see

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-27 00:54