16227 10

[回归分析求助] 边际效应的两种求法 [推广有奖]

  • 2关注
  • 6粉丝

副教授

51%

还不是VIP/贵宾

-

威望
0
论坛币
209 个
通用积分
2.2690
学术水平
1 点
热心指数
2 点
信用等级
1 点
经验
20134 点
帖子
657
精华
0
在线时间
601 小时
注册时间
2013-11-7
最后登录
2018-1-6

楼主
宇宙无极2013 发表于 2015-1-21 09:46:27 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
各位,我做logit模型(有5个显著),回归后用mfx求边际效应,发现没有一个显著的;但是我又用margins求边际效应却发现出现了5个变量显著,请问这个该怎么办?是继续用mfx还是用margins?谢谢!
二维码

扫码加我 拉你入群

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

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

关键词:边际效应 Margins logit模型 margin logit 模型

沙发
蓝色 发表于 2015-1-21 19:54:43
没有什么不一样的啊

. webuse lbw
(Hosmer & Lemeshow data)

. logit low age lwt  smoke ptl ht ui

Iteration 0:   log likelihood =   -117.336  
Iteration 1:   log likelihood =  -104.7002  
Iteration 2:   log likelihood = -104.39685  
Iteration 3:   log likelihood = -104.39591  
Iteration 4:   log likelihood = -104.39591  

Logistic regression                               Number of obs   =        189
                                                  LR chi2(6)      =      25.88
                                                  Prob > chi2     =     0.0002
Log likelihood = -104.39591                       Pseudo R2       =     0.1103

------------------------------------------------------------------------------
         low |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |  -.0422544   .0345836    -1.22   0.222     -.110037    .0255281
         lwt |  -.0142885   .0066523    -2.15   0.032    -.0273267   -.0012502
       smoke |   .5506312   .3436293     1.60   0.109    -.1228697    1.224132
         ptl |   .5932548   .3484191     1.70   0.089     -.089634    1.276144
          ht |   1.862491   .6862291     2.71   0.007     .5175064    3.207475
          ui |   .7367904   .4564882     1.61   0.107      -.15791    1.631491
       _cons |    1.37896   1.088893     1.27   0.205    -.7552312    3.513151
------------------------------------------------------------------------------

. mfx

Marginal effects after logit
      y  = Pr(low) (predict)
         =  .28930847
------------------------------------------------------------------------------
variable |      dy/dx    Std. Err.     z    P>|z|  [    95% C.I.   ]      X
---------+--------------------------------------------------------------------
     age |  -.0086879      .00708   -1.23   0.220  -.022558  .005183   23.2381
     lwt |  -.0029378      .00135   -2.18   0.029  -.005579 -.000297    129.82
   smoke*|   .1156273      .07302    1.58   0.113  -.027487  .258742   .391534
     ptl |   .1219786      .07191    1.70   0.090  -.018965  .262922   .195767
      ht*|   .4340082      .14329    3.03   0.002   .153163  .714854   .063492
      ui*|   .1652437      .10863    1.52   0.128  -.047676  .378164   .148148
------------------------------------------------------------------------------
(*) dy/dx is for discrete change of dummy variable from 0 to 1


. margins,dydx(*) atmean

Conditional marginal effects                      Number of obs   =        189
Model VCE    : OIM

Expression   : Pr(low), predict()
dy/dx w.r.t. : age lwt smoke ptl ht ui
at           : age             =     23.2381 (mean)
               lwt             =    129.8201 (mean)
               smoke           =    .3915344 (mean)
               ptl             =    .1957672 (mean)
               ht              =    .0634921 (mean)
               ui              =    .1481481 (mean)

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |  -.0086879    .007077    -1.23   0.220    -.0225585    .0051827
         lwt |  -.0029378   .0013475    -2.18   0.029    -.0055789   -.0002968
       smoke |   .1132148   .0703391     1.61   0.107    -.0246472    .2510768
         ptl |   .1219786   .0719113     1.70   0.090     -.018965    .2629222
          ht |    .382945     .14083     2.72   0.007     .1069232    .6589668
          ui |   .1514908    .093994     1.61   0.107    -.0327341    .3357157
------------------------------------------------------------------------------



已有 1 人评分经验 学术水平 热心指数 收起 理由
SpencerMeng + 60 + 1 + 1 热心帮助其他会员

总评分: 经验 + 60  学术水平 + 1  热心指数 + 1   查看全部评分

藤椅
宇宙无极2013 发表于 2015-1-22 09:48:34
耶,那我为什么两者不一样呢?用mfx都没有显著的,而用margins却有好几个显著,是怎么回事,没有搞明白

板凳
蓝色 发表于 2015-1-22 13:25:14 来自手机
应该一样才对

报纸
sunshinewp 发表于 2016-3-6 09:42:45
蓝色 发表于 2015-1-22 13:25
应该一样才对
我想请教一下,当因变量是四分类定序变量(ologit)的时候,用margins dydx(*)求边际效应时,是不是跟mlogit的求法是一样的呀,就是说还是得一个一个的求,是吗?

地板
蓝色 发表于 2016-3-6 09:46:34
sunshinewp 发表于 2016-3-6 09:42
我想请教一下,当因变量是四分类定序变量(ologit)的时候,用margins dydx(*)求边际效应时,是不是跟mlogi ...
Title

    [R] ologit postestimation -- Postestimation tools for ologit


Description

    The following postestimation commands are available after ologit:

    Command              Description
    ----------------------------------------------------------------------------------------------------------------------
        contrast         contrasts and ANOVA-style joint tests of estimates
        estat ic         Akaike's and Schwarz's Bayesian information criteria (AIC and BIC)
        estat summarize  summary statistics for the estimation sample
        estat vce        variance-covariance matrix of the estimators (VCE)
        estat (svy)      postestimation statistics for survey data
        estimates        cataloging estimation results
    (1) forecast         dynamic forecasts and simulations
        lincom           point estimates, standard errors, testing, and inference for linear combinations of coefficients
        linktest         link test for model specification
    (2) lrtest           likelihood-ratio test
        margins          marginal means, predictive margins, marginal effects, and average marginal effects
        marginsplot      graph the results from margins (profile plots, interaction plots, etc.)
        nlcom            point estimates, standard errors, testing, and inference for nonlinear combinations of
                           coefficients
        predict          predictions, residuals, influence statistics, and other diagnostic measures
        predictnl        point estimates, standard errors, testing, and inference for generalized predictions
        pwcompare        pairwise comparisons of estimates
        suest            seemingly unrelated estimation
        test             Wald tests of simple and composite linear hypotheses
        testnl           Wald tests of nonlinear hypotheses
    ----------------------------------------------------------------------------------------------------------------------
    (1) forecast is not appropriate with mi or svy estimation results.
    (2) lrtest is not appropriate with svy estimation results.


Syntax for predict

        predict [type] {stub* | newvar | newvarlist} [if] [in] [, statistic outcome(outcome) nooffset]

        predict [type] {stub* | newvarlist} [if] [in] , scores

    statistic          Description
    ----------------------------------------------------------------------------------------------------------------------
    Main
      pr               predicted probabilities; the default
      xb               linear prediction
      stdp             standard error of the linear prediction
    ----------------------------------------------------------------------------------------------------------------------
    If you do not specify outcome(), pr (with one new variable specified) assumes outcome(#1).
    You specify one or k new variables with pr, where k is the number of outcomes.
    You specify one new variable with xb and stdp.
    These statistics are available both in and out of sample; type predict ... if e(sample) ... if wanted only for the
      estimation sample.


Menu for predict

    Statistics > Postestimation > Predictions, residuals, etc.


Options for predict

        +------+
    ----+ Main +----------------------------------------------------------------------------------------------------------

    pr, the default, calculates the predicted probabilities.  If you do not also specify the outcome() option, you specify
        k new variables, where k is the number of categories of the dependent variable.  Say that you fit a model by
        typing ologit result x1 x2, and result takes on three values.  Then you could type predict p1 p2 p3 to obtain all
        three predicted probabilities.  If you specify the outcome() option, you must specify one new variable.  Say that
        result takes on the values 1, 2, and 3.  Typing predict p1, outcome(1) would produce the same p1.

    xb calculates the linear prediction.  You specify one new variable, for example, predict linear, xb.  The linear
        prediction is defined, ignoring the contribution of the estimated cutpoints.

    stdp calculates the standard error of the linear prediction.  You specify one new variable, for example, predict se,
        stdp.

    outcome(outcome) specifies for which outcome the predicted probabilities are to be calculated.  outcome() should
        contain either one value of the dependent variable or one of #1, #2, ..., with #1 meaning the first category of
        the dependent variable, #2 meaning the second category, etc.

    nooffset is relevant only if you specified offset(varname) for ologit.  It modifies the calculations made by predict
        so that they ignore the offset variable; the linear prediction is treated as xb rather than as xb + offset.

    scores calculates equation-level score variables.  The number of score variables created will equal the number of
        outcomes in the model.  If the number of outcomes in the model was k, then

        The first new variable will contain the derivative of the log likelihood with respect to the regression equation.

        The other new variables will contain the derivative of the log likelihood with respect to the cutpoints.


Examples

    Setup
        . webuse fullauto
        . ologit rep77 i.foreign length mpg

    Predicted probabilities for each of the five outcomes
        . predict poor fair avg good exc

    Average marginal effects on the probability of an excellent repair record
        . margins, dydx(*) predict(outcome(5))


    Report information criteria
        . estat ic

7
sunshinewp 发表于 2016-3-6 16:46:16
蓝色 发表于 2016-3-6 09:46
Title

    [R] ologit postestimation -- Postestimation tools for ologit
额,不好意思,我英语不是很好,所以还是不是很懂,是不是如果要一次全出来的话,就得用predict?具体怎么弄,能举个例子吗?

8
zabbyy 发表于 2017-12-13 17:29:29
蓝色 发表于 2016-3-6 09:46
Title

    [R] ologit postestimation -- Postestimation tools for ologit
你好,我可以请教一个问题吗?tobit估计后求边际影响,系数符号相反是为什么呢?

9
317792209 在职认证  学生认证  发表于 2018-5-21 22:08:05
研究了一下margins和mfx针对有序Logit的用法,不要用错了哈。mfx默认所有解释变量在样本平均值处的边际效应
QQ图片20180521220220.png



按时毕业,按时睡觉。多发论文,多赚点钱。

10
宛如青空 发表于 2019-7-14 10:15:32
请问如何求虚拟自变量的边际效应呢,看了连老师的方法,是要手动计算吗,还是有其他代码

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

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